public static void main(String[] args) {
        try {
            File f = null;
            JFileChooser fChsr = new JFileChooser();
            int ret = fChsr.showOpenDialog(null);
            if (ret == JFileChooser.APPROVE_OPTION) {
                f = fChsr.getSelectedFile();
            }
            Scanner scnr = new Scanner(f);
            while (scnr.hasNext()) {
                System.out.println(scnr.next());
            }
        } catch (FileNotFoundException ex) {
            System.out.println(ex);
        } catch (Exception ex) {
            System.out.println(ex);
        }
    }