This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv 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 REST with Spring (video course) this week in the Spring 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: 19852

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.
I agree. Here's the link:
subject: Getting access to already running Java Web Start application
It's not a secret anymore!