Reputation: 3914
I was trying to run an Ant script in Eclipse, but I am getting the below error:
BUILD FAILED
C:\Users\name\workspace\Client\build\Build_Local.xml:111: Error running C:\Program Files\Java\jdk1.6.0_45\jre\bin\javac compiler.
My java home is pointed to jdk and I edited the java path in windows>preferences>installed jre as well as in run>external tool>config>jre. Both locations are pointed to jdk. Also I am posting my build file(This is not the exact file, I have edited a lot before posting)
<?xml version="1.0"?>
<project name="projectName" default="main" basedir="C:\path\build">
<property name="LocalHome" value="C:\proName" />
<property name="home" value="${LocalHome}"/>
<property name="java.home" value="C:\Program Files \Java\jdk1.6.0_45"/>
<property name="CLIENT_JAR" value="client.jar"/>
<target name="main" description=": This is the default target.">
<antcall target="name"/>
</target>
<target name="name">
<javac failonerror="true" srcdir="${home}/source" destdir="path to class file"
executable="${java.home}\bin\javac" fork="true" debug="on" encoding="UTF-8"
source="1.6" target="1.6" bootclasspath="${java.home}/jre/lib/rt.jar"
classpath=""/>
</project>
See here I mentioned the javac path to "C:\Program Files \Java\jdk1.6.0_45\bin\javac". Then why does Ant choose javac from C:\Program Files\Java\jdk1.6.0_45\jre\bin\javac (see the build error)
Upvotes: 0
Views: 9063
Reputation: 49978
${java.home}
points to C:\Program Files\Java\jdk1.6.0_45\jre. So you should be able to just remove that from bootclasspath
:
bootclasspath="${java.home}/lib/rt.jar"
If you put the following line below a target, you'll see it print out the full path with jre
appended:
<echo level="info" message="java.home = ${java.home}"/>
Upvotes: 0
Reputation: 3914
It worked when I directly used java home path(C:\Program Files\Java\jdk1.6.0_45) in place of java.home
Upvotes: 1