BufferedReader fileReader = null;
try {
fileReader = new BufferedReader(new InputStreamReader(new FileInputStream("myfile.txt")));
String line;
while ((line = fileReader.readLine()) != null) {
System.out.println(line);
}
} catch (FileNotFoundException ex) {
Logger.getLogger(TestPOI.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(TestPOI.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
fileReader.close();
} catch (IOException ex) {
Logger.getLogger(TestPOI.class.getName()).log(Level.SEVERE, null, ex);
}
}