Link to home
Create AccountLog in
Avatar of csalem01
csalem01Flag for Afghanistan

asked on

java JFileChooser crashes firefox

I have an applet that crashes firefox (by crash I mean completely freezes up and I have to open the task manager and kill the process) most of the time when a dialog from JFileChooser is created.  the applet is signed and it works fine in IE.  Does anyone know of a workaround for this, or another class that I can use?  Here's my java code:


import javax.swing.JApplet;
import javax.swing.JFileChooser;

public class TestJFileChooser extends JApplet{

      public void init(){}
      public void selectLocalFiles(){
            AccessController.doPrivileged(new PrivilegedAction<Object>(){
                  public Object run() {
                        JFileChooser jfc = new JFileChooser();

                        int returnval = jfc.showOpenDialog(null);    //this is where it crashes
                        if(returnval == JFileChooser.APPROVE_OPTION){
                        return null;

and here's the html page:


<applet id='imagemgr' name='imagemgr' code='TestJFileChooser.class' archive="TestJFileChooser3.jar" mayscript='mayscript' width=0 height=0></applet>

<a href="javascript: addAttachment()">Test JFileChooser</a>

function addAttachment(){
      var selectedfile = new Array();
      var startpos = 0;
Avatar of sciuriware

May be that's the reason that FireFox 3.0.1 is released.

FireFox: Help-> check for updates ......

Avatar of csalem01


It actually crashes more often with the update.  Seems to crash everytime now.

It only appears to crash if I call the selectLocalFiles() function from javascript.  I added a button to the applet that calls that function and it works fine.
Let Mozilla know about this.

I reported it to mozilla.  So they'll probably get to it 3 years from now, if ever :(

Can you think of any workaround, or anything besides the JFileChooser that I can use?

Do you think I should report this to Sun as well, I wasn't sure if this would be a bug in firefox or the java plug-in?

Some clients have been complaining about this, so any workaround you can think of would be helpfull
Avatar of sciuriware

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Hopefully java 6u10 fixes the problem, since they're completely changing how applets work.