Skip to main content

path to windows 7 'libraries' from JFileChooser

1 reply [Last post]
Joined: 2010-08-10


I am running windows 7 - 64 bit. Java version is 1.6.0_20.

Our software uses a JFileChooser to display the dialog to create a new file/project. After passing the if statement in the fragment below the user has chosen his file.

if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(parentFrame))
File file = chooser.getSelectedFile();

If the user navigated to one of windows 7's new 'libraries' then the path associated with the file that is returned on the next line by the getSelectedFile() method is not a valid path. It looks like:


where sdfg is the filename. This isn't flagged immediately, but the root cause is here. The new windows 7 libraries are not filesystem locations, but some sort of reference (although they appear in the filesystem), so I can see why it is like this, but it is a problem, because they do link to filesystem locations.

I have ended up writing some incomplete and not ideal path substitution methods as a work around. Anyone know any proper way of dealing with this? Is quite hard to search for anything to do with libraries, so I have not managed to find anything.



Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-07-24

This is obviously a bug, but not in the JFileChooser, of course, but in classes.

I suggest to submit a bug report at