Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ant compilation problem.

Status
Not open for further replies.

jsulman

Programmer
Jun 14, 2001
85
0
0
US
I am trying to run a build file that is failing on the javac task. The problem is that my default javac.exe as defined in my Path command is a 1.4 compiler (it has to remain t his way). I am running ant in eclipse and in eclipse I am using a 1.5 sdk.

Here is my javac target:
<target name = "build" depends = "init" description="build all">
<javac
srcdir="${src.dir}" destdir="${build.dir}"
target= "C:\_Tools\jdk1.5.0_07\bin\javac.exe"
source = "1.5"
fork = "yes"
includes="**">
<classpath refid = "classpath"/>
</javac>
</target>
The error I am getting is:
javac: invalid target release: C:\_Tools\jdk1.5.0_07\bin\javac.exe
I have tried it without the target attribute and it gives me a
invalid source release: 1.5
error.
It seems that ant is running from my default javac and not the 1.5. Does anybody know how I can specify a specific javac for ant to use? I thought the target attribute was supposed to do that.

I am using XP and my JAVA_HOME is set to C:\Program Files\Java\jdk1.5.0_07\bin.

Thank you in advance.

Jeff Sulman
 
Never Mind.
I found the answer.
Add these attributes to the javac task:

source = "1.5"
target = "1.5"
executable="${jdk5.0.bin}/javac"

where jdk5.0.bin is the the directory where the javac resides.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top