views:

93

answers:

2

Hi,

We are using WebStart JNLP file to create a shortcut on our users` desktop.

The problem is that we would like the code in our jar file to be launched only when the user press the desktop shortcut. However, Java WebStart executes the jar also on the first launch (when we set the desktop icon).

Is there any way we can set the icon without running the jar, but to launch the jar when the user press the desktop icon?

+2  A: 

why not have two different webstart apps; one for installing; one for running?

use some logic on your webserver to decide which to run?

Jill Renee
Hi Jill - any idea how to acomplish that? could you refer to a link or add some examples?
Dudi
when you start it from the web page, you could pass it a parameter that says to install only; so have the executable be somewhat intelligent.
Jill Renee
For a normal web page \ server application - that make sense. However, as for JNLP I could not found in the documentation how to pass parameters into the JNLP.I believe the issue is that I need to run different JNLP on my web site than the one installed on the user computer.
Dudi
A: 

In your code first thing check [user.home]/.apphome/.installed (or any other location, it is your choice) file exists. If it does run your app normally. If it doesn't create that file and quit.

Depending on the platform you run it on you can also write into Windows registry, but I'd rather not.

What is your strategy if user doesn't allow shortcut creation via Java config?

parxier
We used the same solution but with a different approuch.We are using Java Muffins to check whether this is the first time the application is launched - and it is working well!
Dudi
@Dudi That's even better.
parxier