I know I am 2 years late to answer here..but you could use a BufferedLineReader to get the scanner to get the line number...