Maven Build error TOOLS.JAR NOT FOUND IN JRE

亡梦爱人 提交于 2021-02-07 12:31:08

问题


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]

回答1:


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.




回答2:


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.




回答3:


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!




回答4:


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.



来源:https://stackoverflow.com/questions/26973145/maven-build-error-tools-jar-not-found-in-jre

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!