Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JFileChooser hangs  RSS feed

 
Fors Judd
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a java prog with one operative line that just creates a JFileChooser.
It hangs on java 1.7 on Linux, but I used to use JFileChooser all the time and it worked fine.
It still runs fine on my Mac with java 1.6.
Does anyone know what to do about it?

 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your intention when passing in "." to the constructor? If you want it to point to the user's default directory then you should pass in null instead. Passing in a file path will always give different results on different platforms.
 
Campbell Ritchie
Sheriff
Posts: 55333
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ran it on Fedora19 with jdk1.7.0_45 and it executed and terminated normally. It did appear a bit slow; it took about 2″ or 3″ to complete.
 
E Armitage
Rancher
Posts: 989
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:I ran it on Fedora19 with jdk1.7.0_45 and it executed and terminated normally. It did appear a bit slow; it took about 2″ or 3″ to complete.


Do you get the same delays with null passed in? Also does the time become different if you run as root vs non root user?
 
Campbell Ritchie
Sheriff
Posts: 55333
157
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
$ java JFC_hang
hello
Duration = 4.904sec gbbye
[campbell@campbell-inspiron1110 rubbish]$ java JFC_hang .
hello
Duration = 1.949sec gbbye
[campbell@...] java JFC_hang ~/java.
hello
Duration = 1.994sec gbbye
[campbell@...]$ su
Password:
[root@...]]# java JFC_hang
hello
Duration = 3.281sec gbbye
[root@...]# java JFC_hang .
hello
Duration = 2.536sec gbbye
[root@...]# java JFC_hang ~/java
hello
Duration = 2.167sec gbbye
Slightly longer for null than a named folder, hardly any difference for root.
 
Fors Judd
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
E Armitage wrote:Do you get the same delays with null passed in?

Passing a null argument is ambiguous:

JFC_hang.java:8: reference to JFileChooser is ambiguous, both method JFileChooser(java.io.File) in javax.swing.JFileChooser and method JFileChooser(javax.swing.filechooser.FileSystemView) in javax.swing.JFileChooser match

Passing NO argument works quickly on the Mac, and hangs on Linux.
 
Fors Judd
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
E Armitage wrote:Also does the time become different if you run as root vs non root user?

Previous to last Friday, the delays were insignificant. Since then the delays have been HOURS; I kill the thing after waiting, say, over night.

It runs on my Mac regardless of whether I am root or not. On Linux I am unable to use root, so I don't know. The java versions are different:

iMac: java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

linux: java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!