Il seguente codice funziona
`
\documentclass[a4paper]{article}
\usepackage{listings}
\usepackage{color}
\lstset{frame=tb,
language=Java,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\small\ttfamily},
numbers=none,
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
breaklines=true,
breakatwhitespace=true,
tabsize=3,
breakindent=0pt
}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\begin{document}
\begin{lstlisting}
// Linea commentata molto lunga che quindi viene spezzata nel file di uscita
\end{lstlisting}
\end{document}
`
Vedi se riesci a produrre un esempio minimo compilabile che riproduce il problema.
Ciao,
Matteo