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 95147 - Null pointer exception on file chooser
Summary: Null pointer exception on file chooser
Status: RESOLVED DUPLICATE of bug 61438
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: issues@editor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-10 01:43 UTC by khuegele
Modified: 2007-11-05 13:42 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Null Pointer Exception when invoking file chooser (messages.log) (211.20 KB, text/plain)
2007-02-10 01:45 UTC, khuegele
Details

Note You need to log in before you can comment on or make changes to this bug.
Description khuegele 2007-02-10 01:43:10 UTC
I got the following message when trying to start Netbeans 5.5:
A java.lang.NullPointerException exception has occurred.
Please report this at http://www.netbeans.org/community/issues.html,
including a copy of your messages.log file as an attachment.
Comment 1 khuegele 2007-02-10 01:45:21 UTC
Created attachment 38309 [details]
Null Pointer Exception when invoking file chooser (messages.log)
Comment 2 Jan Lahoda 2007-02-10 09:48:57 UTC
Seems like a duplicate of issue #60757 to me. Please see the last comment by
twuersch in that bug to see possible cause of the problem. Thanks.

*** This issue has been marked as a duplicate of 60757 ***
Comment 3 khuegele 2007-02-10 13:11:58 UTC
I am so sorry, the link to
http://wiki.java.net/bin/view/Netbeans/FaqRunningOnJre
is not found.  I could not find a resolution at
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6210674

The problem came up right after installation.  I did not move anything around. 
I suppose the solution is to link netbeans to JDK instead of to JRE?  How can I
find out to which module netbeans is linking itself currently?  During
installation netbeans searched for the appropriate JDK and found JDK 1.6.0.  I
assume this is what it is using.  All the buttons are whacked out.  Is there a
way to do this outside of the IDE?

Thanks for your help.
Comment 4 khuegele 2007-02-10 13:27:10 UTC
Referring to problem description at
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6210674
"Create a java application, set the L&F to system, create a JFileChooser.
Prerequisits is of course a external harddrive with custom icon."

Netbeans is not installed on an external hard drive.  No custom icon is being
setup.  I don't know what 'set the L&F to system' mean, so most likely I didn't
perform this action.  JDK is located on the same drive as netbeans.
Comment 5 Vitezslav Stejskal 2007-02-10 23:58:12 UTC
Hi, the problem is very unlikely to be in Netbeans, could you please try the
following:

1. Open console (e.g. run cmd.exe)
2. On command line: java -version<enter>
   It should say something like 1.6.0

3. On command line:
   java -jar <your-java-home>\demo\jfc\FileChooserDemo\FileChooserDemo.jar<enter>

   I am not sure where your JDK is installed, but from the log file you attached
it seems to be in H:\Program Files\Java\jdk1.6.0\, so use this for
<your-java-home>. This will start a simple swing app that demonstrates the use
of FileChooser. If you click the 'Show FileChooser' button and get the
NullPointerException then the problem is in you JDK installation. And I would
suggest reinstalling it.

Thanks.
Comment 6 Vitezslav Stejskal 2007-02-14 01:44:22 UTC
Any luck?
Comment 7 khuegele 2007-02-14 02:38:14 UTC
Hello,
Thank you for your direction.  I ran the demo as you instructed.  The 'Show
FileChooser' button works with no hitches.

I started Netbeans right after that and it still gives me the same behavior.

I would appreciate any directions you can give me to identify and fix the problem.  
Comment 8 khuegele 2007-02-14 02:42:27 UTC
on the command prompt, java -version returns 1.6.0.
Comment 9 Vitezslav Stejskal 2007-02-19 13:11:28 UTC
I see. I am sorry I was not clear in my instructions. There is a combobox called
'Look and Feel' in the FileChooserDemo application, which lets you choose the
look and feel for the demo application and for the filechooser dialog. As
described in the JDK bug the problem occurs when the Look and Feel is set to
'Windows'. Have you tried that? Could you please try it?

Also, the JDK bug description says that no matter where your netbeans or JDK is
installed if there is a special drive on your PC (eg. firewire is what they
mentioned) the JFileChooser will crash when using Windows L&F. From the bug
description it is looking like that there will be no obvious connection between
the cause of the problem and Netbeans or JDK. It might be a special hardware,
which looks like a disk in Windows (eg. a camera, USB stick, ...).

Another thing you could try is forcing Netbeans to use a different L&F (e.g.
Metal). This can be done on the command line when starting netbeans, just add
the following parameter:

-laf javax.swing.plaf.metal.MetalLookAndFeel

Netbeans should start as usually, but will use Metal L&F, which means they will
look a little bit different than what you've seen before. The JFileChooser
dialog should work, because it won't try to look like its native windows version
and will use its own icons, layout, etc. Please try that and let me know.
Comment 10 khuegele 2007-02-19 14:26:50 UTC
I started the FileChooserDemo, picked windows L&F and was able to replicate the
NullPointerException.

I started Netbeans with netbeans.exe -laf javax.swing.plaf.metal.MetalLookAndFeel
and it seems to have fixed the problem.  Thank you very much for your help!
Comment 11 Vitezslav Stejskal 2007-02-19 20:59:40 UTC
Great! Well, we haven't really fixed it, but hopefully the JDK bug will get
fixed soon and you will be able to use the native Windows L&F without any
problems. Thanks.
Comment 12 Marian Petras 2007-02-28 14:33:58 UTC
Reopened so that it can be closed as a duplicate of another issue.
Comment 13 Marian Petras 2007-02-28 14:35:26 UTC

*** This issue has been marked as a duplicate of 61438 ***