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.

Bug 66537 - [50cat] user.home ignored for Platform Manager Sources default
Summary: [50cat] user.home ignored for Platform Manager Sources default
Status: RESOLVED DUPLICATE of bug 47737
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Jesse Glick
Depends on:
Reported: 2005-10-11 23:19 UTC by rrochat
Modified: 2006-02-14 17:58 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description rrochat 2005-10-11 23:19:19 UTC
[ 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 
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")));
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.
Comment 1 Jesse Glick 2005-10-12 01:59:33 UTC
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 ***
Comment 2 rrochat 2005-10-12 04:07:41 UTC
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).

Comment 3 Jesse Glick 2005-10-27 21:37:53 UTC
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 ***
Comment 4 Jesse Glick 2005-10-27 21:47:48 UTC
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/, 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
Comment 5 Tomas Danek 2005-10-31 13:56:46 UTC
> A "D:\D" is also added somehow to Platform sources list. 

filed/fixed (issue 66548)
Comment 6 rrochat 2005-10-31 19:56:32 UTC
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.  
Comment 7 Martin Krauskopf 2005-10-31 23:32:16 UTC
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)