问题
When compiling a project in Eclipse, I get below error:
Fatal error compiling: tools.jar not found:
How is this caused and how can I solve it?
回答1:
Goto Windows -> Preferences
Java -> Installed JREs –> Execution Environment
JavaSE1.x -> JDE 1.x
If you don’t have the JDK
in the Installed JRE
, then
Select the Installed JRE
and Add the JDK
installed path
Let's try to configure your run configurations to clean install
![](https://www.eimg.top/images/2020/02/28/52baa7496e03ae8bd19122dd5de5d631.png)
Click on the small black arrow and then Run Configurations
After, you just put clean install in your Maven goal, like this :
![](https://www.eimg.top/images/2020/02/28/e6c8de1f554ad90bd241d15169314831.png)
And then, try to run your compilation, and we will see what happens... :)
回答2:
You need to put the right Java Build path for your project.
In Eclipse:
--> Right click the project name - Properties (keyboard shortcut: [Alt] + [Enter] )
--> Libraries
--> Change the JRE7 to JDK7.
And I think the problem will be solved that way ;)
来源:https://stackoverflow.com/questions/25185634/fatal-error-compiling-tools-jar-not-found