ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <>
Subject Re: Ant not obeying JAVA_HOME?
Date Tue, 21 Sep 2004 09:17:07 GMT

Emmanouil Batsis wrote:
> Dear tribe,
> When running Ant through ant-launcher.jar like:
> java -jar ant-launcher.jar -buildfile /path/to/build.xml
> I get the following:
> Unable to locate tools.jar. Expected to find it in C:\Program 
> Files\Java\j2re1.4.2_04\lib\tools.jar
> However, the above path points to my JRE, while my JAVA_HOME env 
> property points to the JDK. From what i remember my linux box 
> demonstrated the same behaviour using a SUN JDK. What am i missing?

The Ant launcher code does not process environment variables since java 
does not provide access to these. You have two choices

1. Just use the java command from the JDK area directly and not rely on 
the OS path to find it. (especially since java.exe on Windows systems 
can often exist in Winnt\system32, etc). So,

%JAVA_HOME%\bin\java -jar ant-launcher.jar -buildfile /path/to/build.xml

2. Pass tools.jar in the classpath

java -cp %JAVA_HOME%\lib\tools.jar;ant-launcher.jar -buildfile /path/to/build.xml

Because you're using the -cp option, I don't think you can use the -jar 
option too, IIRC.

Of course, a lot of this stuff is what ant.bat is all about. It does 
what it does to ensure it can run Ant no matter how the user's system is 
setup :)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message