try { // Open the file that is the first // command line parameter FileInputStream fstream = new FileInputStream(file); // Convert our input stream to a // DataInputStream DataInputStream in = new DataInputStream(fstream); // Continue to read lines while // there are still some left to read while (in.available() !=0) { // Print file line to screen text.setText(text.getText()+in.readLine()); } in.close(); } catch (Exception e2) { System.err.println("File input error"); }