Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JFileChooser hangs

 
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?

 
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.
 
Marshal
Posts: 69873
278
  • 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
Marshal
Posts: 69873
278
  • 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)
 
Crusading Chameleon likes the size of this ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic