-----Original Message----- From: Christopher Lenz [mailto:[EMAIL PROTECTED] Sent: 28 November 2003 16:19 To: Cactus Users List Subject: Re: "You must either set location or path on <pathelement>" Exception Message
Vincent Massol wrote:
Hi Simon,
Here's the code used by the <cactus> task to find the tools.jar
file:
protected final File getToolsJar() throws FileNotFoundException { String javaHome = System.getProperty("java.home"); // TODO: Fix this as it fails on Max OSX (which doesn't have
a
// tools.jar file). File toolsJar = new File(javaHome + "/../lib/tools.jar"); if (!toolsJar.isFile()) { throw new
FileNotFoundException(toolsJar.getAbsolutePath());
} return toolsJar; }
So it means it cannot find it in [javahome]/../lib/tools.jar
Do you know where it is for you (i.e. what directory)?
Hmm, does this mean that this works for you in Eclipse?
Obviously this code is quite broken, and was just one of those quick
and
dirty hacks none of us ever produces ourselves ;-) I think that
tools.jar
(or whatever classpath entry contains the Java compiler) should
normally
always be on the Ant classpath. So some type of lookup to find the resource that contains the compiler should do the trick. I'll need to look into
the
<javac> etc, to see how the Ant folks get the compiler on the
classpath of
a forked VM.
Ok cool. I agree. One of the problem with eclipse when you use Ant from within Eclipse is that Eclipse automatically creates a JRE setup (and not a JDK one) and thus the tools.jar is missing. But I agree that once the JVM is correctly setup, we should be transparent. What we could do maybe is simply try to load some class from tools.jar to see if it's on the cp somewhere?
That's what I've been thinking, but it won't work for people using JDKs other than Suns. But it'd definitely be better than the current approach.
The solution must be somewhere in the Ant code base, I hope :-/
-chris
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
