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.
When attempting to open an existing project or any file, for that matter, a NullPointerException occurs.
Created attachment 35814 [details] messages log showing java.lang.NullPointerException
I attempted to diagnose this issue as a possible UNC path problem by moving the NB USERDIR default from HOME to another location, as shown in the message log configuration parameters. However, it appears that NB still uses HOME as the default location for new projects, and possibly existing projects(?) which may be causing the problem? This change had no effect. I had noted similar problems in NB 5.0 under WinXP in this environment.
Reassigning to projects - ui
Suggested workaround is to change your Home dir using nb.exe -J-Duser.home=<path>
The suggested workaround has no effect. On the ND About/Detail window, Home Dir is still show as a UNC path: \\gasbar\Redirect$\carson. The User Home directory had been previously moved by modifying the netbeans.conf file to explicitly change its location: # ${HOME} will be replaced by JVM user.home system property #netbeans_default_userdir="${HOME}/.netbeans/5.5" netbeans_default_userdir="C:\.netbeans\5.5" When attempting to create a new project, the default location showed the UNC path format and a warning icon appeared in the bottom left corner of the window complaining about an invalid path name.
Issue #46813 records that UNC paths should be supported generally in NB. Currently they are not. You should use a non-UNC user directory. Editing netbeans.conf ought to work for that purpose; perhaps you edited the wrong file etc. You can always use --userdir from a command shell to try a particular userdir temporarily. For creating projects, you must use a non-UNC path. Mount a drive letter as needed. The NPE looks unrelated to me; some bug in Swing. Please file it on the Java BugParade. *** This issue has been marked as a duplicate of 46813 ***
Perhaps I'm characterizing the problem incorrectly. I can move the netbeans.conf file to any location (if the location contains a UNC pathname, an warning message is printed in the log file stating build.properties cannot be properly written to). I just moved it back to the default location of netbeans_default_userdir="${HOME}/.netbeans/5.5". This is translated to "C:\Documents and Settings\carson\.netbeans\5.5" on my system according to the Help/About/Detail page. However, the "Home Dir" field on that page has always shown a UNC pathname ("\\gasbar\Redirect$\carson"). This value is populated on the "New Project [...]" page along with the message at the bottom stating "Project Folder is not a valid path." This invalid path message disappears if I replace the UNC path with a drive letter path. I believe this is what is occurring when I attempt to open an existing project (created on another workstation), except, the NPE occurs and browser window never opens. Therefore, the question should be, "How do I permanently modify the 'Home Dir' parameter so that it does not use the UNC pathname provided by my roaming profile?" There does not appear to be a command line option to do this.
"Home Dir" doesn't matter much. It is used as an *initial default* location for New Project but no more. (Should remember a different location after you first use it.) Pick a different location to create projects in. If you want to use your home dir you must first mount it on a drive letter and use that path instead. *** This issue has been marked as a duplicate of 46813 ***
Replacing the UNC pathname on a new project with a drive letter equivalent allows me to create a new project in the desired location; however, I can still not open an existing project without experiencing the NPE error. Furthermore, if I close the new project and attempt to reopen it I cannot do so unless I choose "File/Open Recent Project". NB does remember the new Home Dir location as a drive letter path, however, you still cannot use the Browse button, even when creating new projects. As it stands, I can only create new projects and open recent projects. The workarounds proposed have not been sufficient.
Afraid we cannot help you with the NPE as this looks like a bug in Swing's filechooser implementation on Windows: ShellFolder sf = (ShellFolder)files[i]; icon = new ImageIcon(sf.getIcon(true), sf.getFolderType()); ^^^^^^^^^^^^^^^^ null for some reason I don't know what about your environment would trigger such a bug. (You're not running Vista or any otherwise unusual version of Windows?) Please file it on BugParade so it is tracked. You may wish to try a different JDK, e.g. JDK 6 (a current build like b104, *not* a beta) which might have a fix for this NPE. It might also help to run with a nonnative look and feel until the NPE is resolved: http://wiki.netbeans.info/wiki/view/FaqCustomLaf
Under WinXP SP2, for both JRE 1.5.0_09 and JRE 1.6.0-beta2, the problem is corrected by using the "javax.swing.plaf.metal.MetalLookAndFeel" as suggested in the NB wiki. It still exists in JRE 1.6.0-beta2 using the default Windows look-and-feel. I will file a bug report with Sun regarding this issue.
Appears to be similar to BugID 6210674 (FileChooser fails to load custom harddrive icon and gets NullPointerException) in Sun Developer Network Database. Workaround is to not use Windows L&F.
Again, try a current build of JDK 6, not a beta. I have no idea if this area of code has been touched since then but it is quite possible.
OK, recording that. It does look like the problem you are having. If you have any removable drives you don't need, try removing them to see if that helps. Or if you're more adventurous and/or bored I'm sure you could figure out how to patch WindowsPlacesBar.java to do a proper null check, compile it, jar it, and add e.g. -J-Xbootclasspath/p:c:\6210674-patch.jar to your options in netbeans.conf.