Skip to main content

${com.sun.aas.javaRoot} variable reference

6 replies [Last post]
driesknottnerus
Offline
Joined: 2009-03-16

Hi, I am using Glassfishv3-prelude. How can I see the value of variables like ${com.sun.aas.javaRoot} and is it possible to change these values?
I spent some time checking out manuals and forums on this subject, but this seems to be a well-kept secret.

Regards, Dries

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Jerome Dochez

This is a system variable so you can just use the JDK APIs but I am
afraid it won't have the results you expect. What are you trying to
do ? change the JDK version prelude runs with ?

jerome

On Mar 16, 2009, at 8:43 AM, glassfish@javadesktop.org wrote:

> Hi, I am using Glassfishv3-prelude. How can I see the value of
> variables like ${com.sun.aas.javaRoot} and is it possible to change
> these values?
> I spent some time checking out manuals and forums on this subject,
> but this seems to be a well-kept secret.
>
> Regards, Dries
> [Message sent by forum member 'driesknottnerus' (driesknottnerus)]
>
> http://forums.java.net/jive/thread.jspa?messageID=337232
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

driesknottnerus
Offline
Joined: 2009-03-16

Yes. I installed Glassfish and noticed that it used the JRE and not the JDK. I got a noJDK-exception. In the Admin Console, at 'Application Server' - 'JVM settings', the default value for Java Home is ${com.sun.aas.javaRoot}. If I change that to the location of my JDK, it works. But the variable ${com.sun.aas.javaRoot} is also used at other places, so it makes more sense to have this variable point to the right location.
In the meantime I also introduced a JAVA_HOME environment variable (My Computer- Advanced- Environment Variable), pointing at my JDK-location. At first, this did not seem to work, but apparently it does now. So it is not much of a problem anymore, but still I would like to know how I can check the value of ${com.sun.aas.javaRoot} .

Jerome Dochez

the easiest way to change the JDK location used by glassfish is to
modify the asenv.conf AS_JAVA variable.

jerome

On Mar 17, 2009, at 3:01 AM, glassfish@javadesktop.org wrote:

> Yes. I installed Glassfish and noticed that it used the JRE and not
> the JDK. I got a noJDK-exception. In the Admin Console, at
> 'Application Server' - 'JVM settings', the default value for Java
> Home is ${com.sun.aas.javaRoot}. If I change that to the location of
> my JDK, it works. But the variable ${com.sun.aas.javaRoot} is also
> used at other places, so it makes more sense to have this variable
> point to the right location.
> In the meantime I also introduced a JAVA_HOME environment variable
> (My Computer- Advanced- Environment Variable), pointing at my JDK-
> location. At first, this did not seem to work, but apparently it
> does now. So it is not much of a problem anymore, but still I would
> like to know how I can check the value of ${com.sun.aas.javaRoot} .
> [Message sent by forum member 'driesknottnerus' (driesknottnerus)]
>
> http://forums.java.net/jive/thread.jspa?messageID=337380
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Ludovic Champenois

On 3/17/09 9:53 PM, Jerome Dochez wrote:
> the easiest way to change the JDK location used by glassfish is to
> modify the asenv.conf AS_JAVA variable.
This will work, but you still need to have a JRE or JDK in your path for
running the script asadmin that uses the 'java' command getting it from
your environment/path, not from AS_JAVA ... So If you have nothing in
your path, asadmin will still fail...(and all other commands: wsimport,
wsgen, stopserv, jspc...as well) in the glassfish bin dir. Bug?

Ludo
>
> jerome
>
> On Mar 17, 2009, at 3:01 AM, glassfish@javadesktop.org wrote:
>
>> Yes. I installed Glassfish and noticed that it used the JRE and not
>> the JDK. I got a noJDK-exception. In the Admin Console, at
>> 'Application Server' - 'JVM settings', the default value for Java
>> Home is ${com.sun.aas.javaRoot}. If I change that to the location of
>> my JDK, it works. But the variable ${com.sun.aas.javaRoot} is also
>> used at other places, so it makes more sense to have this variable
>> point to the right location.
>> In the meantime I also introduced a JAVA_HOME environment variable
>> (My Computer- Advanced- Environment Variable), pointing at my
>> JDK-location. At first, this did not seem to work, but apparently it
>> does now. So it is not much of a problem anymore, but still I would
>> like to know how I can check the value of ${com.sun.aas.javaRoot} .
>> [Message sent by forum member 'driesknottnerus' (driesknottnerus)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=337380
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Kedar Mhaswade

Ludovic Champenois wrote:
> On 3/17/09 9:53 PM, Jerome Dochez wrote:
>> the easiest way to change the JDK location used by glassfish is to
>> modify the asenv.conf AS_JAVA variable.
> This will work, but you still need to have a JRE or JDK in your path for
> running the script asadmin that uses the 'java' command getting it from
> your environment/path, not from AS_JAVA ... So If you have nothing in
> your path, asadmin will still fail...(and all other commands: wsimport,
> wsgen, stopserv, jspc...as well) in the glassfish bin dir. Bug?

Well, it depends. If "installers" don't actually make sure
right Java is available for server and tools, then it's a bug.
But if you just get a "web.zip" or "glassfish.zip", you, as a user
must ensure that you have access to "java" in your Path.

> Ludo
>>> In the meantime I also introduced a JAVA_HOME environment variable
>>> (My Computer- Advanced- Environment Variable), pointing at my
>>> JDK-location. At first, this did not seem to work, but apparently it
>>> does now. So it is not much of a problem anymore, but still I would
>>> like to know how I can check the value of ${com.sun.aas.javaRoot} .

The theory behind AS_JAVA was to provide an installation wide
JAVA_HOME and refer to it by a token. So, the spirit was noble.
Now, you know that for one "installation" (i.e. set of "bits") there
is one asenv.conf[.bat]. But you can have multiple "domains" that utilize
the same installation. It may so happen that domain1 uses Java 1.6.0_01
and domain2 uses 1.6.0_05 (for this JDK update has fixed a bug that it needs).

To address such things, we decided:
- domain.xml -> @ java-home is where you set the "overriding"
JAVA_HOME
- the launcher piece of code would then carefully choose the "correct" or
intended Java and also set this token "very early" in the startup to
the right value, so that all the references to token are replaced
correctly.

Sadly, some of this sane theory is defeated lately and we introduced lots of
options that ended up confusing users like you. I am hoping in the fullness
of time (September release), we will have a way in which we will answer
the question "Which Java is used by server???" without any ambiguity.

-Kedar

>>> [Message sent by forum member 'driesknottnerus' (driesknottnerus)]
>>>
>>> http://forums.java.net/jive/thread.jspa?messageID=337380
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

driesknottnerus
Offline
Joined: 2009-03-16

Thank you for all your comments, gentlemen.
I conclude from this:
- It is not possible to view or set the ${com.sun.aas.javaRoot} variable directly.
- ${com.sun.aas.javaRoot} is only mentioned in processLauncher.xml and in domain.xml, but it is not set there.
- Glassfish sets this variable when it is started. If no AS-JAVA or JAVA-HOME is present, it will use the path system variable.
- You can override the use of the path system variable by setting AS-JAVA in asenv.conf (server wide), or by setting JAVA-HOME in in domian.xml (domain wide).
- These variables only work in the admin console, if you use the asadmin command in a DOS-window, you have to put the JDK-libs in your path.
- Apparently some other problems exists, but hopefully they will be adressed in the september release.
In my case, I don't use JAVA-HOME or AS-JAVA, but I have put the JDK-bin lib in my path, this seems to work. So I consider my question answered.