When i try to generate a war file, it is showing some error like
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Program Files\Java\jre7\..\lib\tools.jar
When i do echo %path%
it shows
C:\Windows\System32;D:\name\name1\Softwares\Maven\apache-maven-3.0.4\b
in;C:\Program Files\Notepad++\;%JDK_HOME%
When i do echo %JDK_HOME%
D:\name\name\core java\software\Java\Java_1.6.0_04_win\jdk1.6.0_04\bin
I don't know why maven is refering to jre, when my environmental variable is jdk. I also changes installed JRE to jdk1.6.
In Eclipse, actions like importing Maven projects or invoking "Update Sources" runs in the same JVM in which Eclipse is running. If that JVM comes from JRE that isn’t part of JDK, there would be no Java compiler (the tools.jar).
So to launch Maven from within Eclipse, JRE used for launch also need to come from JDK. By default Eclipse registers JRE it is started in, but this can be configured on "Window / Preferences… / Java / Installed JREs" preference page as mentioned above by Parthasarathy
Alternatively you can specify compilerId in the pom.xml, so Maven won’t be looking for JDK when compiling Java code:
I have encountered a similar problem, and as no one posted an approach similar to mine, here I go.
It depends on of Maven version. When you will install newer version of Maven, this error would not appear. You may also add another directory with tools.jar file lib/tools.jar - it also solve this problem.