Hi, When JDK 1.5.0_01 is installed, Ant 1.6.2 breaks. It complains: Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.5.0_01\lib\tools.jar But in reality this file does not exist. In JDK 1.5.0_01, tools.jar only exists in C:\Program Files\Java\jdk1.5.0_01\lib\tools.jar Please post a workaround until this is fixed in the next release of Ant.
Workaround is including that file by hand: ant -lib C:\Program Files\Java\jdk1.5.0_01\lib\tools.jar But I think your environment is net set correctly. Just a view into ant.bat: - execute %HOME%\antrc_pre.bat - check ANT_HOME - check Java 1) set _JAVACMD=%JAVACMD% 2) use java.exe from JAVA_HOME\bin 3) use java.exe from PATH - start Ant - execute %HOME%\antrc_post.bat 1) I think your JAVA_HOME points to the JRE and not to the JDK. 2) If you cant reset your JAVA_HOME you could try to reset it in the %HOME% \antrc_pre.bat and restore it in %HOME%\antrc_post.bat 3) If that doesnt work you could include tools.jar in CLASSPATH (maybe set in the pre bat). These are the first statements about "Workaround" and first thoughts. I havent verified that behaviour yet.
Jan, You are a life saver. Turns out my JAVA_HOME still pointed to jdk1.5.0 instead of jdk1.5.0_01. I don't know why this caused Ant to look inside my JRE directory instead of JDK (maybe it got the wrong key from the registry?!) but anyway fixing this value fixed the problem. I don't think that the JDK/JRE installer sets JAVA_HOME, so you guys should really have this working if it is undefined. I tried undefining it and it keeps on looking inside my JRE directory. Any idea why? Thanks, Gili
JAVA_HOME is an environment variable both on windows flavours and unix flavours. If no JAVA_HOME is set ant uses the location of the found java executable to determine JAVA_HOME itself. In case the found java executable is from the JRE and not the JDK then tools will not be found. In case a wrong JAVA_HOME is provided which has been either set by you, or your administrator (or by an installer of some other program) it will be happily used, and not yield the desired effect.