Reputation: 61
When I am trying to debug my code then I am getting the following error:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2
[INFO] ------------------------------------------------------------------------
[ERROR] **Failed to execute goal org.apache.maven.plugins:maven-compiler-**plugin:2.0.2:compile (default-compile) on project napier-am: Compilation failure
Unable to locate the Javac Compiler in:
C:\Program Files (x86)\Java\jre6\..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
-> [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
Upvotes: 2
Views: 102
Reputation: 61
Yeah Thanks for the clue.. Everyone is correct. In my JDK version tools.jar was not available thats why I was getting this problem its not finding tools.jar, While JAVA_HOME varible is configured correctly. Need to focus on only Tools.jar so that installed again java version (i am using java 6) Now come on project--> go thru the build path and Make sure---- click on
installed jre edit jre home =C:\Program Files (x86)\Java\jdk1.6.0_25
give path accordingly for which Your OS is compatible
Upvotes: 0
Reputation: 7045
Your JAVA_HOME
path is not set. You need to set it as C:\Program Files\Java\jdk <version>
Upvotes: 1
Reputation: 676
Maven uses JAVA_HOME to access Java's location on the machine. In Your situation You point it to JRE not JDK. Set properly JAVA_HOME environment variable and it will work.
If You want to have different location/version used for Maven only You can edit mvn.bat file with something like this.
set JAVA_HOME=<path_to_other_jdk>
Upvotes: 1
Reputation: 611
Everything is said in the exception:
Unable to locate the Javac Compiler in: C:\Program Files (x86)\Java\jre6..\lib\tools.jar
Your maven task is trying to "compile" something, but can't find the Java compiler (JDK=Java Development Kit).
Please ensure you are using JDK 1.4 or above and not a JRE.
Instead it finds a JRE=Java Runtime Environment (which is used for running java programs, not compiling them).
you can change the location of your Java installation by setting the JAVA_HOME environment variable
You need to have a valid JDK version installed and your JAVA_HOME environment variable must point to this JDK folder.
Upvotes: 0