Reputation: 377
I have a JNLP file, normally I will execute with console (Linux) and works perfect.
javaws launch.jnlp
But now I have to run from Java code, I tried this...
Process p = Runtime.getRuntime().exec(new String[]{"path/to/.jnlp"});
p.waitFor();
Not working, as it should run.
Upvotes: 5
Views: 18046
Reputation: 377
This is my solution:
Process exec = Runtime.getRuntime().exec("javaws /var/www/Projects/jnlp/jnlp1/launch.jnlp");
exec.waitFor();
In linux:
.jnlp
.Add javaws
in the path of the function:
Runtime.getRuntime().exec("javaws Path/to/jnlp");
Upvotes: 1
Reputation: 168825
It the.jnlp
is in user.home
it is as simple as:
File f = new File(System.getProperty("user.home"));
f = new File(f, "the.jnlp");
Desktop.getDesktop().open(f); // Launches the associated application to open the file.
Upvotes: 1