Getting access to already running Java Web Start application
posted 6 years ago
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.
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.