When you try to choose file or directory and have no rights to open it, choosers (javafx.stage.DirectoryChooser and javafx.stage.FileChooser) throws an error, while when trying to select the file/dir with javax.swing.JFileChooser it returns file, and throws an error only when start opening.