This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JNLP and Web Start and the fly likes Getting access to already running Java Web Start application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "Getting access to already running Java Web Start application" Watch "Getting access to already running Java Web Start application" New topic

Getting access to already running Java Web Start application

Lukasz Szymik

Joined: Jun 16, 2006
Posts: 2
Hi Everybody,

I am developing an large application which has to operate in the Web and Desktop environment.
My current use case in this application will be that user will navigate for items in the Web based application and as soon as the item will be found there will be a link on the page which will start simple (small) Java Web Start application with parameter pointing to the founded item number. This small Web Start application should have access to local resources and other application started on the same machine.

My question is:
Could I get access to already running Web Start application (JVM) over JNLP link? I mean that user click on the first item on the web page and JWS application is started. Then user is clicking on the next item on page and the same already started application should get the new parameter to work on. I would like to avoid of starting second JVM and simple get access to already started instance of application.

Thanks in advance for any information, suggestion and help.

Best regards

Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

There's nothing like this in the JNLP spec. So, basically you're asking how you can only run one instance of an application on a system. The usual way to do this is for the application to open a ServerSocket on a predetermined port. Then if you try to run a second copy, it won't be able to open that ServerSocket because the first copy has it open already. At this point the second copy should just terminate.

If there are parameters involved, the second copy could then send them to the first copy by sending a message over the predetermined port before it terminates.. The application would have to be coded to accept parameters in this way.
It is sorta covered in the JavaRanch Style Guide.
subject: Getting access to already running Java Web Start application
Similar Threads
Test 252: Mock exam
Web app design confusion
using an applet to open another window (JFrame)
One instance of application at a time use database file
How to disable BACK button of the browser?