dev@glassfish.java.net

Re: Specifying JVM options through environment variables

From: Ludovic Champenois <Ludovic.Champenois_at_Sun.COM>
Date: Thu, 29 Oct 2009 04:41:49 -0700

On Oct 29, 2009, at 4:22 AM, Sander Sõnajalg
<sander.sonajalg_at_gmail.com> wrote:

>
> Hi,
>
> my problem is a bit more specific, actually. As I told, I am
> developing an extension to Sun's existing Eclipse WTP integration
> plugin. What i want to achieve is that somebody installs my Eclipse
> plugin, checks some additional checkboxes (that enable certain VM-
> options for Glassfish), then start glassfish with Eclipse WTP, and
> the specified JVM-arguments are now set to the JVM that runs his
> glassfish. If i would only have to do this in my own machine, then
> of course the easiest way would be to go and manully add the
> required VM-options to domain.xml. But as I want it to work on
> *anybody*'s machine, this is a bit harder. The last thing i would
> like to do is make my eclipse plugin go dig up the user's
> domain.xml, parse it, add my VM-arguments to it, save the changes,
> and *then* execute glassfish. Setting some environment variable
> would be way easier. But if you provide no hooks or extension-points
> to do this, it seems that i have no other options. Is that really
> so? : /(

Correct...
We didi not implement this in eclipse plugin, but we did it in
Netbeans and this is basically the way to do it.
In fact we are using amx style APIS to do this even for remote servers
where domain. Xml is not accesible as a file.
Maybe you could contribute your work to our gf eclipse plugin?

> thansk once again,
> sander
>
>
>
> --------------------
>
> From: Byron Nevins <Byron.Nevins_at_Sun.COM>
>
> 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
>
> ======================================================
>
>
>
>
>
>
>
> 2009/10/28 Sander Sõnajalg <sander.sonajalg_at_gmail.com>
>
> 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
>
>
>