Eclipse Juno Release
Window / Preferences / Java / Installed Jres
shows two installed Jres.
jdk1.7.0_07
and jre7
.
I get the following error when trying to clean
and process-classes
with maven:
Failed to execute goal org.apache.maven.plugins:maven-compiler-
plugin:2.4:compile (default-compile) on project reputation: Fatal
error compiling: tools.jar not found: C:\Program
Files\Java\jre7\..\lib\tools.jar
I added tools.jar
as external jar already, out of desperation, but it didn't help. Why is maven trying to use the other JRE
?
EDIT:
Compiler plugin excerpt from pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.4</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
Maven Configuration The Maven tool uses JDK version 11.0. 10. The default JDK is set to 13.0.
Maven always uses the JDK specified by JAVA_HOME , no matter how many JDK installations are available on the system. This allows the user the flexibility to change JDKs as required or based on the project. Hence, it is important to ensure JAVA_HOME is defined.
Maven needs a JDK, and not a JRE. Thanks, Ok yep it is installed.. both JDK and Maven... BUT JAVA_HOME returns Nothing...so still I have some configuration to do to set my JAVA_HOME on OSX ? and without that nothing (EClipse, IntelliJ, etc..)
You need to set your JAVA_HOME environment variable to the JDK directory.
EDIT:
In your installed JREs preferences window in Eclipse remove the JRE and select the JDK. Also make sure that your project is set to use that JRE library (Right-click on the "JRE System Library" under your maven project structure in the explorer and set it as the "Execution Environment")
You should verify that the Maven "run configurations..." is connected to the correct JRE. If the project JRE is correct but the run configuration JRE is incorrect you will get this error. To fix, go Under Maven Build, choose the JRE tab.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With