public static void main(final String[] args) throws Exception { final JFileChooser opener = new JFileChooser(System.getProperty("user.home")); final int result = opener.showOpenDialog(null); if (result == JFileChooser.APPROVE_OPTION) { convertImg(opener.getSelectedFile()); } System.exit(0); }