Computing Magazine

Unable to Locate Compiler Error in Eclipse and Maven

Posted on the 27 June 2013 by Abhishek Somani @somaniabhi
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project test-commons: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Program Files\Java\jre7\..\lib\tools.jar
[ERROR] Please ensure you are using JDK 1.4 or above and
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn  -rf :test
This error occurs because maven uses java compiler classes available in tools.jar to compile java files. Tools.jar is part of jdk , not the jre. So if you have configured only jre in eclipse , you will get this error. To resolve this , go to prefreneces and select java and configure jre. Unable to locate Compiler Error in Eclipse and Maven Now edit this independent JRE and give path to JDK. Unable to locate Compiler Error in Eclipse and Maven Unable to locate Compiler Error in Eclipse and Maven So , to run maven in eclipse , you should have path to jdk , not individual installed JRE. Unable to locate Compiler Error in Eclipse and Maven Post Comments and Suggestions !!!

Back to Featured Articles on Logo Paperblog

Magazines