I have my JAVA_HOME set to:
C:\\Program Files (x86)\\Java\\jdk1.6.0_18
After I run maven ins
I changed the configuration of maven-compiler-plugin to add executable
and fork
with value true.
<configuration>
<fork>true</fork>
<source>1.6</source>
<target>1.6</target>
<executable>C:\Program Files\Java\jdk1.6.0_18\bin\javac</executable>
</configuration>
It worked for me.
Go to Eclipse's menu Window → Preferences... → Java → Installed JREs should point to the JDK you installed, not to the JRE.
As mentioned by several others, the Eclipse Window → Preferences... → Java → Installed JREs should point to the JDK you installed, not to the JRE. Only then it can find the ../lib
folder mentioned in the error message.
Even with this, the problem may recur. My way out in Eclipse v4.2 (Juno) is to do a menu Maven → Update project... after which the problem disappears.
I suspect the reason is that some of the Eclipse generated files (.classpath, .project, .preferences) are in Subversion for the project in which I'm having these problems. Thus, an SVN update introduces the problem, and an configuration update from Maven in Eclipse resolves it again.
Real solution: omit Eclipse generated .files from version control, and let the Maven Eclipse plugin handle project configuration. (Additional pointers/suggestions are welcome).
Many other answers tell you to point your Eclipse to a JDK instead of a JRE.
Here is another answer with more specific/clear [than I have seen in any answer here] step-by-steps on how to do that: How do you install JDK?
That is what for solved me for this same problem.
You could try updating the JDK Eclipse is using, as follows:
Add and set the JRE in menu Window → Preferences... → Java → Installed JREs:
JRE type: Standard VM JRE
Name: jdk1.6.0_18
JRE home directory: C:\Program Files (x86)\Java\jdk1.6.0_18
If this is not the case, it's possible that the brackets and spaces in the JAVA_HOME path are causing issues. Try copying your JDK to a different location and updating your JAVA_HOME.
Based on Compiling Sources Using A Different JDK, you will have to set the fork to true in your pom.xml file.