How can I get the absolute path of a directory using JFileChooser, just selecting the directory?
Use:
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
//or
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
together with:
chooser.getCurrentDirectory()
//or
chooser.getSelectedFile();
then call getAbsoluteFile()
on the File
object returned.