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 only runs once from GET method

 
Bartender
Posts: 1752
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although the JFileChooser code runs fine (over and over) as a regular Java application, when I put that code into a REST service, it only runs once. That is, the dialog only comes up the first time I hit the URL.

The URL code in the service itself is this:




Which instantiates this class:



Called, like this:

localhost:4567/fileChooser

------

The first time I start the service, I see the JFileChooser dialog and it returns the file selected.

Second and subsequent tries to invoke the same URL, I get a FileChooser[,0,0,0x0,invalid] error in the debugger.

Any ideas what's going on?

Trying to just add a simple file picker to a web service that's called by a third-party application.

TIA

- mike
 
Mike London
Bartender
Posts: 1752
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It appears from my research after the posting above that JFileChooser will hang due to bugs under different circumstances. In the case above, it would only run once then hang.

However, I found a posting, here: https://stackoverflow.com/questions/18642158/why-does-jfilechooser-showopendialog-hang-on-mac-osx

that has an AWT workaround using File Dialog, which works perfectly every time!

PROBLEM SOLVED.

- mike
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic