troubleshooting Question

java JFileChooser crashes firefox

Avatar of csalem01
csalem01Flag for Afghanistan asked on
JavaWeb Browsers
6 Comments1 Solution705 ViewsLast Modified:
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 java.security.AccessController;
import java.security.PrivilegedAction;

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();
                        jfc.setMultiSelectionEnabled(true);

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

and here's the html page:

<html>
<body>

<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>

<script>
function addAttachment(){
      var selectedfile = new Array();
      var startpos = 0;
      document.getElementById("imagemgr").selectLocalFiles();
}
</script>
</body>
</html>
ASKER CERTIFIED SOLUTION
sciuriware

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros