Forum Stats

  • 3,816,065 Users
  • 2,259,136 Discussions


JFileChooser initialization very slow in Java 1.8

Pooja Reddy
Pooja Reddy Member Posts: 1
edited Dec 4, 2017 3:32AM in Swing


Our application is in Java 1.8.0_121. We are using "JFileChooser"  and see that its ridiculously slow always (not just first time)

Below is the thread dump stack trace which tells what was event thread doing then

"AWT-EventQueue-2" prio=0 tid=30 nid=0 waiting on condition [on lock [email protected]]

    java.lang.Thread.State: WAITING (parking)

    at sun.misc.Unsafe.park(Native Method)

    at java.util.concurrent.locks.LockSupport.park(Unknown Source)

    at java.util.concurrent.FutureTask.awaitDone(Unknown Source)

    at java.util.concurrent.FutureTask.get(Unknown Source)

    at$ComInvoker.invoke(Unknown Source)

    at Source)

    at Source)

    at Source)

    at Source)

    at Source)

    at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.addItem(Unknown Source)

    at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.access$800(Unknown Source)

    at javax.swing.plaf.metal.MetalFileChooserUI.doDirectoryChanged(Unknown Source)

    at javax.swing.plaf.metal.MetalFileChooserUI.access$1100(Unknown Source)

    at javax.swing.plaf.metal.MetalFileChooserUI$5.propertyChange(Unknown Source)

    at Source)

    at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)

    at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)

    at java.awt.Component.firePropertyChange(Unknown Source)

    at javax.swing.JFileChooser.setCurrentDirectory(Unknown Source)

    at javax.swing.JFileChooser.<init>(Unknown Source)

  at javax.swing.JFileChooser.<init>(Unknown Source

We see the same stacktrace everytime this slowness is observed.

Can you guys please help in identified what is the problem here ? I dont see any huge files in the default directory which is "My Documents"

Any code changes needed to be done to fix this ?


This discussion has been closed.