This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
[ BUILD # : 200509261930 ] [ JDK VERSION : 1.5.0_05 ] Summary: a user.home directory specified on the command line is ignored when you try to add a new NetBeans source directory. 1. Invoke NetBeans and define a user.home directory: netbeans.exe -J-Duser.home=d:/myjavahome 2. Tools / NetBeans Platform Manager 3. Click the Sources tab. 4. Click "Add Folder..." 5. A JFileChooser opens on C:\Documents and Settings\rrochat\My Documents. I realize this isn't a P1 by any means, but this pattern seems to be appearing in more and more dialogs and is the single most annoying thing about the IDE (I wish I could vote for this more than once. I have NO java files any where near that directory and don't understand why user.home is used by some dialogs but ignored by others. If you're not going to use this property for the default directory, please provide another property that I can set or explain some other means of avoiding the default user.home setting when the past selection is not remembered. It wouldn't be hard to fix: fileChooser.setCurrentDirectory(new File(System.getProperty("user.home"))); http://www.netbeans.org/servlets/BrowseList?list=netcat&by=thread&from=252569 for more background. Another unrelated bug and much less annoying, but while you're in this code: A "D:\D" is also added somehow to Platform sources list. I can "Remove" this but it seems to reappear later. Closing and re-opening the dialog isn't enough to get it to re-appear. Exiting and re-starting the IDE *will* cause it to appear, but I don't know if that's directly or undirectly related.
Issue #47737 tracks the general lack of an API suitable for this purpose. Re. "another unrelated bug" - as you say, it's unrelated, so if you can reproduce it, please file it separately with details. *** This issue has been marked as a duplicate of 47737 ***
Issue 47737 is about saving the last file selection, which is a noble cause, but I don't want that. I just want a defined default starting point that can easily solved by using user.home. Yes, it can be nice when the dialog is really smart and can guess what I want, but I don't see how you could infer the location of netbeans sources from any other file selection that I make. Just as often as not (i.e. the New Module Project's Project Location), these intelligent guesses are not at all what I want. (Its choice is still better than "My Documents," but I'd still rather have it use my specified user.home).
We just make a new JFileChooser(). Whatever its default behavior is, that is what you get. FileSystemView.getDefaultDirectory() calls into some vendor-specific code; feel free to file an RFE for the JDK that this should honor ${user.home} as a system property rather than Windows' notion of the default directory. In the meantime, issue #47737 would at least make the initial value less arbitrary; but ultimately the IDE cannot really guess where you might have downloaded sources (your Desktop? a temp folder somewhere? a lib area of your project dir?) so you are going to have to pick it. BTW the Quick File Chooser module installs a file chooser which keeps a folder history, which is another approach. *** This issue has been marked as a duplicate of 47737 ***
In particular, the platform-independent default behavior *is* to use ${user.home} (so this should work on Linux, e.g.). However for Windows this is overridden in j2se/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java, to pick the W32 location 'PERSONAL' and, failing that, 'DESKTOP'. So you may be able to regedit32 your way to perfection: Windows is configured to think of "C:\Documents and Settings\rrochat\My Documents" as the default location for everything.
> A "D:\D" is also added somehow to Platform sources list. filed/fixed (issue 66548)
I understand that you're using the default JFileChooser behavior, but I don't see why we're stuck with that. I also don't want to "regedit32 my way to perfection" and modify variables that are used by other programs in other ways. I just want it to use the netbeans user.home directory I have already specified. I can easily modify my own sources, but thought this enhancement would save others time and frustration too.
Also see the issue 67834. Probably shared for all platform related choosers - sources, javadoc, plaf itself. I hope I'll implement it for 5.0, since 47737 doesn't seem to be fixed soon (and should be simplefix for 67834 as well)