Java browser and swing

So I'm working in a Swing application guaranteed to run only on Windows systems using Java 1.6 u 7. The users want a help button to launch a local web browser and point to the company's web site.

After reading online and finding that getDesktop.browse() sometimes crashes in that version of Java, I use Runtime.exec("rundll ...") to kick off the local browser with the appropriate web address.

The browser comes up appropriately, but the original Swing application's mouse pointer converts to an hourglass; I can click on the original window and get results but I can't open a new window.

So I create a short thread implementing the Runnable interface and put the Runtime.exec call in that thread; I assume the problem is that the process is interfering with the GUI thread, and putting the Runtime.exec call in a separate thread will clear the problem up. It doesn't work; I still have the hourglass.

I read online that some processes require that their input and error streams be consumed, or they may block; That shouldn't be a problem with internet explorer, but I add two threads to consume those streams; still no change.

I also tried getDesktop().browse() anyway, and in a separate thread, and had the same problem.

Does anyone have any suggestions?


Brian P.
Who is Participating?
pendell2Connect With a Mentor Author Commented:
In fact, if you re-read the original thread you'll see that I already attempted to split the processing off into a second thread.

I have since investigated and learned that it wasn't a threading issue, or indeed a java issue -- the legacy programmer had deliberately disabled the GUI under circumstances.  I have since learned why it was done and how to re-enable the GUI, but that's specific to the app, regrettably.  
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
you may have to use two threads, on click of the button span onethread and return (so the hour glass doesn't show up) and then in this first thread span the second one which does browse. this will work for sure try it. I have done it for many apps.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.