I'm planning on using Hibernate for persistence in an application I'm
writing, but am having some trouble initially building Hibernate. I've
unzipped it into a directory, run the build batch file (I'm doing this
on Windows 2000), and I get the following errors:
"Unable to locate tools.jar. Expected to find it in C:\Program
Files\Java\jre1.5.0\lib\tools.jar"
(despite the fact that JAVA_HOME is set to "C:\Program
Files\Java\jdk1.5.0" which does contain tools.jar under lib)
"BUILD FAILED
C:\Documents and Settings\Administrator\My
Documents\code\third_party_packages\h
ibernate-3.0\build.xml:195: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK"
(however, JAVA_HOME definitely points to the JDK).
I'm guessing this is an Ant issue, since the build script invokes Ant,
and that there's some issue with either my JAVA_HOME or CLASSPATH.
Also, my PATH does include the folder with the javac executable, though
it seems that the compiler's being invoked from the JVM and not the
command line. What should I make sure is set as far as environment
variables go? Is there anything I have to be change of in the batch
file or the Ant build script?
Any help would be much appreciated (I'm working on a neglected pet
project of mine that I'd like to start coding on again).
john martin - 07 Apr 2005 22:27 GMT
> I'm planning on using Hibernate for persistence in an application I'm
> writing, but am having some trouble initially building Hibernate. I've
[quoted text clipped - 26 lines]
> Any help would be much appreciated (I'm working on a neglected pet
> project of mine that I'd like to start coding on again).
also, manually adding tools.jar to the classpath didn't change anything.
is there a reason Ant wouldn't use the JAVA_HOME and CLASSPATH
information from the system-wide environment variables?
thanks again for any help...
richard.anderson970@gmail.com - 07 Apr 2005 22:44 GMT
Java can't find jar files that aren't specifically named. If you have
%JAVA_HOME%/lib in your classpath, it won't find jars in there; you
have to spell out exactly what you want in the classpath.
So, %JAVA_HOME%/lib/myjar.jar, etc. in the CLASSPATH var. should take
care of the issue. This applies to zip files as well.
-Rich
john martin - 08 Apr 2005 20:13 GMT
> Java can't find jar files that aren't specifically named. If you have
> %JAVA_HOME%/lib in your classpath, it won't find jars in there; you
[quoted text clipped - 4 lines]
>
> -Rich
the thing is though, i did put tools.jar in my classpath (the actual jar
file, not the containing folder), and it didn't make a difference. the
other thing that seems wierd to me is that it's ignoring the JAVA_HOME
environment variable (Ant keeps looking in the JRE folder even after i
pointed JAVA_HOME to the JDK folder).
JDK 1.5 installs in "Program Files" by default, so i put it there, but
i've seen problems like this with spaces in file paths before, so do you
think it's worth moving to a file path with no spaces and resetting the
environment variables?