tags:

views:

765

answers:

4

Is there a way via the jnlp file, to set up an environmental variable? I want to set the JAVA_TOOL_OPTIONS in order to do some LTW with aspectj.

Thanks

A: 

In the resources section of the JNLP you can add any number of property nodes after your jars. These then become equivalent to a -D option on the command line.

<resources>
    <j2se...
    <jar href="...

    <property name="env0" value="value0"/>
    <property name="env1" value="value1"/>
    <property name="env2" value="value2"/>
</resources>
banjollity
Unfortunately I don't think that helps. In my testing this has no effect setting JAVA_TOOL_OPTIONS as a property. Is actually setting a property supposed to be equivalent to an environmental variable? The reason I want to set JAVA_TOOL_OPTIONS is to define a new javaagent for Load Time Weaving.
gommo
A property is not an environment variable.
skiphoppy
+1  A: 

I think your best bet is going to be to set the variable on the client side before running java web start.

There are ways to pass parameters to the JVM, if there's a JVM parameter that will do what you want -- I'm not sure what JAVA_TOOL_OPTIONS does.

skiphoppy
The problem with that is that it negates the use of webstart. At this stage it looks like we'll have to use compile time weaving instead of load time, that is all
gommo
A: 

Currently there appears to be no way to set the javaagent via webstart. This prevents us using load time weaving with a webstart application. We'll revert to compile time weaving for now.

gommo
A: 

Not really an answer, but an addition: Here is the relevant bug to vote on for enabling load-time weaving webstart applications:

http://bugs.sun.com/view_bug.do?bug_id=6356496

Holger