Skip to Main Content

Desktop.open hangs on non main threads.

843807Jul 17 2010 — edited Jul 20 2010
I have a GUI application that needs to open directories for the user.
This is (will be) a Java 7 application. It requires java.nio.file.attribute.Attributes. My JVM is jdk-64-1.7-b96-03-jun-2010

My problems is that when I call
 java.awt.Desktop.getDesktop().open(file);
where file is a directory, it fails to open the directory, and hangs.
This does not happen when I call it from the "main" thread, during testing, or from trivial starts like
 public static main(String[] args){
java.awt.Desktop.getDesktop().open(File.listRoots()[0]);
}
, but when I call it from a SwingWorker, or other runnable, the call never returns.
I have not tried this yet on Java 6, but I will asap. Until then, is this a known issue? is there a way to get this to work from the EventDispatchThread?

Thanks!
Comments
Post Details
Added on Jul 17 2010
1 comment
1,221 views