Java 编译时出现致命错误:tools.jar 未找到:
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25185634/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fatal error compiling: tools.jar not found:
提问by Uppi
When compiling a project in Eclipse, I get below error:
在 Eclipse 中编译项目时,出现以下错误:
Fatal error compiling: tools.jar not found:
编译时出现致命错误:tools.jar 未找到:
How is this caused and how can I solve it?
这是怎么引起的,我该如何解决?
采纳答案by Valentin Montmirail
Goto Windows-> Preferences
Goto Windows-> Preferences
Java-> Installed JREs–> Execution Environment
Java-> Installed JREs->Execution Environment
JavaSE1.x-> JDE 1.x
JavaSE1.x-> JDE 1.x
If you don't have the JDK
in the Installed JRE
, then
如果您没有JDK
Installed JRE
,那么
Select the Installed JRE
and Add the JDK
installed path
选择InstalledJRE
并添加JDK
安装路径
Let's try to configure your run configurations to clean install
让我们尝试将您的运行配置配置为全新安装
Click on the small black arrow and then Run Configurations
单击黑色小箭头,然后单击运行配置
After, you just put clean install in your Maven goal, like this :
之后,您只需将全新安装放在您的 Maven 目标中,如下所示:
And then, try to run your compilation, and we will see what happens... :)
然后,尝试运行您的编译,我们将看到会发生什么... :)
回答by Valentin Montmirail
You need to put the right Java Build path for your project.
您需要为您的项目放置正确的 Java Build 路径。
In Eclipse:
在日食中:
--> Right click the project name - Properties (keyboard shortcut: [Alt] + [Enter] )
--> Libraries
--> Change the JRE7 to JDK7.
--> 右键单击项目名称 - 属性(键盘快捷键:[Alt] + [Enter] )
--> 库
--> 将 JRE7 更改为 JDK7。
And I think the problem will be solved that way ;)
我认为问题会以这种方式解决;)