Maven Unable to Locate Javac Compiler tools.jar
August 22, 2013Most of us who are new to maven with eclipse, faces the below error.
[ERROR] Unable to locate the Javac Compiler in: [ERROR] C:\Program Files\Java\jre6\..\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
1. Right click on pom.xml and go to Run As->Run Configurations.
2. Click on JRE tab. Check if option workspace default is your JAVA_HOME, then select this option.
3. Or go to alternate JRE and select JAVA_HOME.
4. Now run and check.