View Full Version : obtaining the correct java_home env variable.

07-06-2004, 05:04 PM
I need to obtain the value in the JAVA_HOME environment variable whilst installing so that I can point tomcat to the correct location.
Unfortunately, when build a native executable and bundle a JVM (which I'd prefer to do since it minimizes the things that could go wrong when installing on all sorts of differently configured machines) the $E(JAVA_HOME) returns the temporary location of the bundled JVM rather than the location I really want.
Is there a way to obtain the correct value of $E(JAVA_HOME) and still use native executables with a bundled jvm?

On windows I could obtain the value from registry instead, but I really require a more platform independent solution.


07-06-2004, 05:25 PM
Hi, Gareth,

Could you use a custom bean that uses one of the getEnvironmentVariable methods of the system-utility service? I believe $E uses one flavor of that method, but you might still be able to get the raw value...

07-06-2004, 06:16 PM
Thanks Robert,
looks like the getRawEnvironmentVariable() does the trick.


09-11-2004, 09:34 PM
Any chance you might be able to post a java snipet that shows the implementation you came up with to get the correct JAVA_HOME? I've been messing around trying to solve this problem and haven't had your success...

Any help would be welcomed!