Dudi
Dudi

Reputation: 43

Java WebStart JNLP: Run Different Code in First Run

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?

Upvotes: 1

Views: 578

Answers (2)

parxier
parxier

Reputation: 3871

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?

Upvotes: 0

Jill
Jill

Reputation: 539

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

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

Upvotes: 2

Related Questions