You need to set your java variables, see if setting these variables solves
your problems..

####################################
IF EXIST "C:\apache-ant-1.7.0" set ANT_HOME=C:\apache-ant-1.7.0
IF EXIST "C:\apache-ant-1.7.1" set ANT_HOME=C:\apache-ant-1.7.1


IF EXIST "c:\Program Files\Java\jdk1.6.0_11" set JAVA_HOME=c:\Program
Files\Java\jdk1.6.0_11

IF EXIST "C:\Program Files (x86)\Java\jdk1.5.0_17" set JAVA_HOME=C:\Program
Files (x86)\Java\jdk1.5.0_17

set CLASSPATH=%JAVA_HOME%\lib

set Path=%ANT_HOME%\bin;%JAVA_HOME%\bin;%PATH%
####################################



-----Original Message-----
From: robert lazarski [mailto:robertlazar...@gmail.com] 
Sent: Friday, January 09, 2009 11:18 AM
To: user@ant.apache.org
Subject: Can't find tools.jar when invoking ant programatically

Hi all,

I'm running ant 1.7.0 with jdk1.6.0_11 on linux. I have the jdk, and
not the jre. However, I get this error when invoking ant
programatically, via
"project.executeTarget(project.getDefaultTarget())" and the like.
Here's my error:

/programs/atadapter/oa/openAdapter/ati.build.xml:49: 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.
It is currently set to "/usr/local/jdk1.6.0_11/jre"

Actually, my JAVA_HOME is set as:

/root> echo $JAVA_HOME
/usr/local/jdk1.6.0_11

I know I have a jdk since I choose to downloaded that and not the jre,
but anyways, I can do this:

 /root> which javac
/usr/local/jdk1.6.0_11/bin/javac

I tried adding /usr/local/jdk1.6.0_11/lib/tools.jar to the build.xml
files path as:

<path id="oa.classpath">
     <fileset dir="/usr/local/jdk1.6.0_11/lib/">
        <include name="tools.jar"/>
     </fileset>
 </path>

But that didn't help either. Any ideas?
Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to