导入 javafx.scene.control.Alert 无法解析
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30393751/
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
The import javafx.scene.control.Alert cannot be resolved
提问by Nadeem
I am getting the error with following two imports in Eclipse:
我在 Eclipse 中出现以下两个导入错误:
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
The errors are: "The import javafx.scene.control.Alert cannot be resolved" and same is true for the 2nd import statement.
错误是:“无法解析导入 javafx.scene.control.Alert”,第二个导入语句也是如此。
I am using Eclipse Version: Luna Service Release 2 (4.4.2) and have installed e(fx)clipse with latest JDK 1.8 (1.8.0_45).
我正在使用 Eclipse 版本:Luna Service Release 2 (4.4.2) 并安装了 e(fx)clipse 和最新的 JDK 1.8 (1.8.0_45)。
There is no problem with other javafx related import statements, such as
其他javafx相关的import语句没有问题,比如
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.input.MouseEvent;
回答by user2922935
I had the same problem, until I installed the JDK 1.8.0_60. That's right, installing the latest JDK helped!
我遇到了同样的问题,直到我安装了 JDK 1.8.0_60。没错,安装最新的 JDK 有帮助!
After you install the latest JDK, change the settings on the Eclipse There are two steps to the process:
安装最新的 JDK 后,更改 Eclipse 上的设置的过程有两个步骤:
回答by Central Thinking Unit
I got the same problem on Eclipse (MacOSX Yosemite) this morning but yesterday everything worked... To solve the problem I just deselected the checkbox for another JDK in Project > Properties > Java Build Path
restarted Eclipse, reselected the good one (JDK 1.8.0_60), restarted Eclipse again and voilà ! Just a weird bug with checkboxes...
今天早上我在 Eclipse (MacOSX Yosemite) 上遇到了同样的问题,但昨天一切正常......为了解决这个问题,我只是在Project > Properties > Java Build Path
重新启动的 Eclipse 中取消选中另一个 JDK 的复选框,重新选择好的(JDK 1.8.0_60),再次重新启动 Eclipse瞧!只是一个带有复选框的奇怪错误......
Hope it ll help you.
希望它会帮助你。