Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I pass a system property to Java via recent version of java webstart?

On my Linux box using an older javaws I can pass a system property to Java via javaws with something like

javaws -J-Dsome.key=some.value http://some.jnlp

However it seems on my Mac using a newer version of javaws this does not work. The "-Dsome.key=some.value" is not passed to the java process (looking at the java process launched by javaws, the -D option is simply not there). However, other Java options are passed without issue, eg.

javaws -J-verbose:gc http://some.jnlp

works fine on both Linux and Mac (I can see the -verbose:gc option fine in the java process launched by javaws).

Does anyone have any ideas? Is it a security setting? Is it a bug in javaws on Mac?

like image 270
Graeme Moss Avatar asked Sep 21 '25 02:09

Graeme Moss


1 Answers

You can do that via Java Control Panel. Goto Java Control Panel > Java > View..

Then type -Dsome.key=some.value under "Runtime Parameters".

Edit: Alternatively you can make sure that your parameters start with "jnlp." such as jnlp.some.key. The reason for this is that with new security restrictions in java you're not allowed to pass parameters unless you either sign you jnlp file (done through jar file manifest) or start your parameter with "jnlp." or "javaws."

like image 156
Saeid Nourian Avatar answered Sep 22 '25 18:09

Saeid Nourian