We help IT Professionals succeed at work.

java JFileChooser crashes firefox

csalem01 asked
Last Modified: 2013-12-29
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();

                        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;
Watch Question

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

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



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
This one is on us!
(Get your first solution completely free - no credit card required)


Hopefully java 6u10 fixes the problem, since they're completely changing how applets work.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.