Why doesn't this very simple code work when it seems to me that it should?
All I expect it to do is to display the contents of a text file in the console of Eclipse...import java.io.*; import javax.swing.*; public class FileInput { public static void main(String[] args) { String fileName = JOptionPane.showInputDialog("Open file: "); PrintWriter inputStream = null; try { inputStream = new PrintWriter(new File(fileName)); } catch(FileNotFoundException e) { System.out.println("Error opening the file " + fileName); System.exit(0); } inputStream.close(); } }
Thanks