Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven can't find tools.jar

I am working on a Spring STS project using Eclipse and when I try to run my unit tests using Run as > Maven test I have the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile)
        on project eshop-sample-spring-legacy: Fatal error compiling: tools.jar not found: 
        C:\Program Files\Java\jre1.8.0_144\..\lib\tools.jar -> [Help 1]

I have Java 8 update 144 installed and my variable environments set as follow:

JAVA_HOME = C:\Program Files\Java\jdk1.8.0_144
JRE_HOME = C:\Program Files\Java\jdk1.8.0_144\jre
Path = ...;C:\Program Files\Java\jdk1.8.0_144\bin;C:\Program Files\Java\jdk1.8.0_144\jre\bin;...

My C:\Program Files\Java folder contains jdk1.8.0_144 and jre1.8.0_144 installation folders.

In Eclipse I set Windows > Preferences > Java > Installed JREs pointing to C:\Program Files\Java\jdk1.8.0_144\jre.

Can somebody help me? Thanks

like image 688
Iaabdenbithen Karim Avatar asked Dec 03 '25 07:12

Iaabdenbithen Karim


2 Answers

Your Windows > Preferences > Java > Installed JREs is pointing to JRE. But tools.jar is not part of the JRE.

So you need to configure your

Windows > Preferences > Java > Installed JREs

to point to

C:\Program Files\Java\jdk1.8.0_144

or where ever you installed your JDK.

like image 180
ujulu Avatar answered Dec 04 '25 21:12

ujulu


Make INSTALLED_JRE point to JDK

like image 20
jmj Avatar answered Dec 04 '25 21:12

jmj