Reputation: 153
I am getting this problem while building maven project .. please help me out..
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project Subs_Engine: Fatal error compiling: tools.jar not found: C:\Program Files\Java\jre7\..\lib\tools.jar -> [Help 1]
Upvotes: 8
Views: 27834
Reputation: 181
Your build path is pointing to the wrong JRE directory/folder. You need to select the JRE folder which is present inside the JDK
Steps to change
for eg C:\Program Files\Java\jdk1.8.0_241\jre 5. Select Finish-> check the folder selected-> apply -> apply and close
Clean your project and compile it. It should work fine :)
Upvotes: 1
Reputation: 51
I faced that error after update my java version from 1.8.0_201 to 1.8.0_221. In the new folder the tools.jar was missing. I found tools.jar file on previous version under "C:\Program Files\Java\jre1.8.0_201\lib" directory(Assuming java is installed under C:\Program Files). I just copied the file and pasted on "C:\Program Files\Java\jre1.8.0_221\lib". The tools.jar file also can be found on "C:\Program Files\Java\jdk1.8.0_161\lib"(version that I installed) directory. It solved my problems. Not quite sure as it is the perfect solution but it works every time. Hopefully same technique would work for other OS too.
Upvotes: 0
Reputation: 57
Tried all that was mentioned in the above solutions but didn't work. Finally, after scratching up my head for hours, I could do it with below actions:
windows > preferences > installed jres > click edit on the selected jre/jdk > add external jar > add in tools.jar
Hope this helps you save a lot of time. Cheers!
Upvotes: 0
Reputation: 803
If you're getting this in eclipse make sure that Eclipse is pointing to a JDK and Not a JRE.
In Eclipse navigate to Window->Preferences->Java->Installed JRES- Add... Standard VM and point Directory... to a JDK. You'll obviously need to install a JDK if you have not done so.
Upvotes: 12
Reputation: 8170
I think you need to point JAVA_HOME to a JDK not just a JRE. The JRE is the java runtime environment while the JDK is for development and will contain the compiler and libs required.
Upvotes: 12