You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Emmanouil Batsis <Em...@eurodyn.com> on 2004/09/21 10:24:22 UTC
Ant not obeying JAVA_HOME?
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?
Cheers,
Manos
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Ant not obeying JAVA_HOME?
Posted by Emmanouil Batsis <Em...@eurodyn.com>.
Conor MacNeill wrote:
> 1. Just use the java command from the JDK area directly [...]
I think i'll try to follow this option
> Of course, a lot of this stuff is what ant.bat is all about.
Right, but I'm trying to avoid using platform dependent scripts and mess
with with the users environment; i'm actually working from within an
installer and trying to be as java-based as possible; thus far
everything works fine on unix and windows :-)
Thanks,
Manos
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Ant not obeying JAVA_HOME?
Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
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
org.apache.tools.ant.launch.Launcher -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 :)
Conor
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org