ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cole, Derek E" <>
Subject RE: Java in JDK but ANT can't find it!
Date Thu, 14 May 2009 13:45:57 GMT
So, I searched the internet for days trying to find out how to do this,
and never could find a straight answer. If you or anyone else has a
better way to do this, let me know, but I found two ways to make this

The first way is to use the AntClassLoader API. I set up a Boolean true,
a null path, and used

AntClassLoader ACL = new AntClassLoader(antproject, path, true);

Which says to use the system classloader, and anything additional in the
path (which I didn't put anything it). This seems to have worked.

The next idea is to set the external compiler property to true.

Hope this helps


-----Original Message-----
From: David Nemer [] 
Sent: Thursday, May 14, 2009 8:15 AM
To: Ant Users List
Subject: Java in JDK but ANT can't find it!

Hello Everyone,

I am running ANT programmatically in JAVA. So, my task is to build the
I'm able to do so, but it throws an exception saying:

/scratch2/nemer/test/xfire/build.xml:5: The following error occurred
executing this line:
/scratch2/nemer/test/xfire/build-common.xml:81: Unable to find a javac
compiler; is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/opt/jdk1.6.0_06/jre"

But in the end it says: BUILD SUCCESSFUL (but it still throws that

I already set all of my environment variables to  /opt/jdk1.6.0_06/
(JAVA_HOME and also in PATH), which is a JDK! And even on the error
it says that the java is set to /opt/jdk1.6.0_06/jre (which is a JDK, I
don't know where it gets the jre from).

So, does any one know how can I solve this problem? Is there a
file in ANT that we need to set up! I'm stuck there!!

I'm running the ant 1.7.1.

David Nemer
Sent from Saarbrucken, SL, Germany

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

View raw message