java - NullPointerException when showing JFileChooser -


I show a JFileChooser with this snippet:

  public file getDestination () {JFileChooser Selector = new JFileChooser (); Chooser.setFileSelectionMode (JFileChooser.DIRECTORIES_ONLY); Int option = chooser.showSaveDialog (faucet); If (option == JFileChooser.APPROVE_OPTION) {return chooser.getSelectedFile (). GetAbsolutePath (); } Return new file ("."); }  

Usually, for the first time shown, it displays & amp; The work correctly the second time, it will always throw this exception:

  formula exception "original L & amp; F file loading thread" sun.awt.shell.Win32ShellFolder2 SunkawtkshellkWin32ShellFolderManager2kisFileSystemRoot (unknown source sun.awt.shell.ShellFolder.isFileSystemRoot on JavaklangkNullPointerException (unknown javax.swing.filechooser on .pidlsEqual) sun.awt.shell on (unknown source). Source on Win32ShellFolder2.equals (unknown source) Javax.swing.filechooser.WindowsFileSystemView.istrraversable on FileSystemView.isFileSystemRoot (unknown source) javax.swing.JFileChooser.istrraversable (unknown source) javax.swing.plaf.basic.basicDirectoryModel At $ LoadFilesThread.run0 (unknown javax.swing.plaf.basic.BasicDirectoryModel $ LoadFilesThread.run (Unknown Source source)) adds  

Java Version:

 

and I found the thread of what I need to downgrade Java version should I follow their advice, or do anything that could be wrong Security was?

It seems that this is actually a version problem / retrograde therefore the answer would be: their advice Follow, you have not done anything wrong;)


Comments