Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Error running javac.exe compiler message, while using Ant in Eclipse

When I run my Ant build in Eclipse, I'm getting the following error message and the Ant build fails.

Error Message: Error running javac.exe compiler

Line where the build stops:

<javac destdir="${classes.home}" debug="on" fork="true" memoryinitialsize="512M" memorymaximumsize="1G">         <classpath refid="classpath"/>         <src path="${source.home}"/> </javac> 

Has anyone faced a similar problem before? or does anybody know what's wrong here?

System Information: Eclipse Helio, JDK 1.5

like image 953
Veera Avatar asked Aug 03 '10 07:08

Veera


People also ask

Is Javac EXE a compiler?

DESCRIPTION. The javac tool reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files.

What is the difference between Java EXE and Javac EXE?

It's a bit of a simplification, but mostly yes. java.exe is how you start the JVM. javac.exe is how you start the compiler. The actual implementation of the JVM and compiler doesn't lie within those particular files (only), however.


2 Answers

I had the same problem and the issue was, in eclipse java.home was referring to JRE instead of JDK. I changed it and the build was successful. You can do the following to change it to JDK:

Preferences > Java > Installed JRE's > Add... For 'JRE Type' select 'Standard VM' > Next > Directory: select your JDK directory (instead of JRE) (in my case: C:\Program Files\Java\jdk1.6.0_16 ), press OK.

Now, you are back at 'Installed JRE's', select the JDK here also.

The below post helped in finding the solution. JAVA_HOME points to the wrong place

like image 52
spbala Avatar answered Sep 22 '22 02:09

spbala


If the accepted answer above doesn't solve the problem for you (as it didn't for me), after updating the java.home to JDK instead of JRE as suggested in the accepted answer above, Go to Run -> External Tools -> External Tools Configuration -> select your build.xml on the left menu -> select JRE tab -> select the JDK(from the dropdown) for Separate JRE radio button option -> Click Run.

This should fix the problem.

like image 36
aram063 Avatar answered Sep 20 '22 02:09

aram063