*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant error running javac compiler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant error running javac compiler" Watch "Ant error running javac compiler" New topic
Author

Ant error running javac compiler

Al Johnston
Ranch Hand

Joined: May 02, 2009
Posts: 99

I know this has been discussed here before (several times). I implemented solutions I found in the forums to no avail. My ant file is performing as expected, up to a point. My build is failing here at line 101 of my code:



The error message I'm receiving is:



I am running ant from Eclipse with -debug on (right click on build.xml and run as ant).

I have set JAVA_HOME and PATH environment variables.

Thanks for your help!

Best,
Al
Max White
Ranch Hand

Joined: Jun 28, 2008
Posts: 85
Hi,
Could you please specify the exact line numbers infront of the code you have pasted.
Thanks
Al Johnston
Ranch Hand

Joined: May 02, 2009
Posts: 99

Sorry Max. I edited them in. Thanks for your help.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

I suspect that your source and target values are bad - try using "1.6" for both (instead of 1.6.0_16).

If that does not help, run ant with the -v option - that might give you more information.


JBoss In Action
Al Johnston
Ranch Hand

Joined: May 02, 2009
Posts: 99

Thanks Peter.

I am on Vista. When I rebooted my computer, suddenly my environment variables work. I know this because now my ant build.xml error is:



I am going to change to 1.6 and try again. But, here's what strange...

If I go to my command prompt and type javac -version, the output is "javac 1.6.0_16". Yet, according to my ant build, that's not a valid version (which is a problem since it's the only version I have installed). I'm going to change to 1.6 and see if that fixes the problem. I'll update the forum following the attempt.

Thanks!

Al
Al Johnston
Ranch Hand

Joined: May 02, 2009
Posts: 99

Sure enough... changing to 1.6 instead of the actual name of the version, I got a good compile. Thanks!
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

[quote[If I go to my command prompt and type javac -version, the output is "javac 1.6.0_16". Yet, according to my ant build, that's not a valid version
The version of the JVM has nothing to do with the values allowed for 'source' and 'target'. For the latter, you use the specification version (or major release version) which is '1.3', 1.4', '1.5', '1.6' or '1.7'; depending on the version of javac you are using (you can't, for example, set the values to '1.7' when using a 1.6.0_16 javac).
Al Johnston
Ranch Hand

Joined: May 02, 2009
Posts: 99

Got it. This was my first ever Ant compile. I really appreciate the help.

Best,
Al
 
Don't get me started about those stupid light bulbs.
 
subject: Ant error running javac compiler
 
Similar Threads
NullPointerException - Alfresco Developer Manual, somecoModuleCore.bootstrapAuthorityCreator
Ant Build file HELP!!-URGENT
ANT BUILD FAILED:Error starting modern compiler
package org.apache.log4j does not exist (Ant build compile)
Ant - Cannot find webwork ActionSupport