Following to some forums answers I\'m using this:
while (fileReader.nextLine() != null) { String line = fileReader.nextLine(); System.out
nextLine() will throw an exception when there's no line and it will never return null,you can try the Scanner Class instead : http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Scanner.html