You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Stefán F. Stefánsson" <st...@snote.decode.is> on 2001/03/02 23:56:34 UTC

Accessing System environment variables.

Sorry for the repost but I'm afraid that some people might have been
scared off with the subject of the other one (was 'Running
EmbeddedTomcat through ant doesn't work').

The basic question is if there is a way to access system variables (like
JAVA_HOME) from the ant buildfile.  I need to get JAVA_HOME so I can
find where 'tools.jar' resides so I can start tomcat.

Anyone?

My previous post is at the end of this message.

Kind regards, 
	Stefan.

-----Original Message-----
From: Stefán F. Stefánsson 
Sent: 2. mars 2001 10:10
To: Ant-User
Subject: Running EmbeddedTomcat through ant doesn't work.


Hello.

I'm trying to run an application through ant.  This application starts
up a webserver (Tomcat) which should serve JSPs and servlets.
Everything works fine when I'm running this application through JBuilder
or from the command line but when I start it up from an ant buildfile I
have problems.

The first time I try to access a JSP page I receive an error that
sun.tools.javac.Main class cannot be found.  This happens in Tomcat when
the JAVA_HOME variable is not set (it can't find the tools.jar file).
This variable is set on my computer but when I start the app up from
within ant things don't work... the app doesn't seem to find the
JAVA_HOME variable.

So my question is:  Is there any way to either get the JAVA_HOME
variable (so I can manually find tools.jar and add it to the classpath
before I start the app through the buildfile) or can I somehow start the
app in a JVM that has access to the system variables?

Kind regards,
	Stefan Freyr

--------------------------------------------
Stefan Freyr Stefansson
Software Developer
deCODE Genetics, Inc.
http://www.decode.com

Phone: (+354) 570 2854
GSM:   (+354) 861 1718
Fax:   (+354) 491 3782
 <<Stefan Stefansson.vcf>> 

Re: Accessing System environment variables.

Posted by Peter Donald <do...@apache.org>.
At 10:56  2/3/01 -0000, Stefán F. Stefánsson wrote:
>Sorry for the repost but I'm afraid that some people might have been
>scared off with the subject of the other one (was 'Running
>EmbeddedTomcat through ant doesn't work').
>
>The basic question is if there is a way to access system variables (like
>JAVA_HOME) from the ant buildfile.  I need to get JAVA_HOME so I can
>find where 'tools.jar' resides so I can start tomcat.

Have a look at property task (specifically the environment attribute) in
the docs which should help you ;)

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*