dev@glassfish.java.net

Re: Specifying JVM options through environment variables

From: Byron Nevins <Byron.Nevins_at_Sun.COM>
Date: Wed, 28 Oct 2009 10:11:25 -0700
Sander,

Are you using V2 or V3? 

We have big improvements in V3 -- see this blog

=========

In V3 you could do something like this -

export FRAME_ENABLED=true

in domain.xml

<jvm-options>-Dmy.framework.enabled=${FRAME_ENABLED}

V3 will look for the token inside domain.xml then in System Properties then, finally, in the environment

======================================================






Sander Sõnajalg wrote:

Hi,

I think this is more like a question to the as-admin CLI developers.. i'm not too sure which is the best list to post it to so i just sent it to dev and admin, hopefully that's okay : )

Ok, I'm really in stuck with one thing, I'd really appreciate if someone could help me out on this one. Namely, i really need to set JVM options to the glassfish server THROUGH setting them into my system environment variables *before* invoking the asadmin. After digging around in your source code repo i'm quite convinced this should somehow be possible (e.g. http://fisheye5.cenqua.com/browse/glassfish/admin-cli/framework/src/java/com/sun/enterprise/cli/framework/CommandLineParser.java). So what i want to achieve would be something like this to work:

$ export SOME_ARGUMENT_THAT_ASADMIN_WOULD_READ='-Dmy.framework.enabled=true'
$ asadmin start-domain myDomain
[and now myDomain starts with "java -jar blablabla -Dmy.framework.enabled=true"]

How can i do this? I have really searched quite a bit for the solution, but not found it : //

(The need for that kind of thing rises from extending your eclipse glassfish WTP plugin. I can make eclipse export my variable into the environment before executing the server. If you take a look at the implementation of the com.sun.enterprise.jst.server.sunappsrv.SunAppServerLaunch#launch(), you'll see that you haven't really left any room for third-party non-hack extensions to that plugin. I need to add a tab to the Eclipse WTP Glassfish launch configuration that would let the user set some additional JVM arguments, and making eclipse set them to the system environment really seems to be the only way.. in case even this path *is* doable, i.e. it is somehow possible to feed my arguments to asadmin like that.

Any help greatly appreciated! : )

Cheers,
Sander