I tried different methods like: InputStream inStream = new FileInputStream(fileName); while (inStream.available() > 0) { System.out.println(inStream.read()); } inStream.close(); However, this too gave the same message as stated in the subject. I even tried adding checking for new line and printing per line. Or even using System.out.print instead, but that gave the error "Too few lines". I am not sure what I am doing wrong.