views:

667

answers:

4

I am running into the problem of the "hanging JFileChooser" as described in the following threads:

http://forums.sun.com/thread.jspa?threadID=5309960

http://forums.sun.com/thread.jspa?threadID=724817

http://x86.sun.com/thread.jspa?threadID=5275999&messageID=10156541

I am using JVM 1.6.0_07-b06. It happens on Windows XP as well as on Windows Vista.

Has anybody found a workaround for this yet?

+1  A: 

I've run into this myself and the updates didn't help. Strangely enough, removing all zip files (particularly large ones) from my desktop (JFileChooser's default location) solved the issue.

bcash
I do not have any zip files on my desktop nor in the file chooser startup location
dkp
bcash
Oh man, this sure helped ME. I can't get how Java is getting THIS ridiculous now. I have been using it at college/hobby and ofc work for going on 9 years now and it is really getting annoying.
Zombies
+1  A: 

There's a bug where if you a networked drive mapped on the desktop, it can sometimes hang on the JFileChooser. That or it might be a shortcut to a networked drive. Something along those lines...

Stephane Grenier
A second floppy drive (remember them?) might also be a problem I think.
Tom Hawtin - tackline
A: 

The .10 update is supposed to fix the zipfile related one.

Tim Williscroft
A: 

Yes, it was a bug, but I believe recent versions of Java no longer have it.
There are a few workarounds(although they are all dirty hacks):

  1. Use a thread to wait until it was initialized
  2. Reuse the same JFileChooser(store it in a variable) instead of creating new ones. If possible, lazily initialize them:

public static JFileChooser chooser = null;

public static void doSomething(){
    if(chooser==null)
         chooser = new JFileChooser();
    //use JFileChooser
}

This way your users have to wait less... but they still will need to wait. The only way to really fix this is to update your JRE.

luiscubal