I have my JAVA_HOME set to
C:\Program Files (x86)\Java\jdk1.6.0_18
After I run maven install I get this message from eclipse:
Reason:
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.
I'm certain that this is the tricky part
Please ensure you are using JDK 1.4 or above and not a JRE
When I run configuration its set to JRE6, how do I change it to JDK 1.6 which I have already installed
EDIT
I even tried to modify the plugin :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<executable>C:\Program Files (x86)\Java\jdk1.6.0_18\bin</executable>
</configuration>
</plugin>
Still I get the same error
Maybe I forgot to say I use eclipse maven plugin .. how can I change from JRE to JDK in eclipse ?
Setting Fork to true resolved the issue for me.
Thank you very much, Sam Yang..you made my day
You can also make sure that Eclipse has all of the updated changes. To do this, right-click your project and then press the "Refresh" menu item.
Right click on Project -> Properties -> Java Build Path. Select the JRE System Path -> Edit. Select the Workspace Default JRE, and point it to JDK > 1.4
Window -> Preferences -> Java -> installed JREs -> Execution Enviroments -> click the checkbox on the right side
do
Echo %JAVA_HOME%
then
mvn --version
JRE
path should be same.... then goWindow -> preferences - java - installed jre's
location should be same as what
Java_Home
is showing.It sounds like Maven is using the JRE, not the JDK. Perhaps you installed Maven before installing the JDK?
Check the settings files. There are 3 in total, system, user, and project. Its most likely in the installation config ($M2_HOME/conf/settings.xml) or, possibly, the per-user config (${user.dir}/.m2/settings.xml).