I have used swing directory chooser to select input directory for my application to process. But if I select a particular directory, for example.. c:/Desktop/user/documents/myfolder filechooser.getcurrentDirectory() returns only "c:/Desktop/user/documents/". Why? Can anyone say why this is happening?
And what code are you using? fileChooser.getSelectedFile() or fileChooser.getCurrentDirectory(); You should use the first option.
It returns the directory you are inside, not the selected file. Remember fileChooser.getSelectedFile() can be a directory as well. http://docs.oracle.com/javase/6/docs/api/java/io/File.html#isDirectory() - you should check the resulting file with this function, to determine, whether it is a directory or not.