导入javafx.scene.control.Alert无法解析 [英] The import javafx.scene.control.Alert cannot be resolved
问题描述
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
错误是:导入javafx.scene.control.Alert无法解析对于第二个import语句也是如此。
我使用的是Eclipse版本:Luna Service Release 2(4.4.2),并安装了e )剪贴最新的JDK 1.8(1.8.0_45)。
与其他javafx相关的import语句没有问题,例如
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.input.MouseEvent;
我有同样的问题,直到我安装了JDK 1.8.0_60。没错,安装最新的JDK有帮助!
安装最新的JDK后,更改Eclipse
上的设置有两个步骤:
-
在
Eclipse>中选择适当的JRE首选项> Java>安装的JRE
如下所示:
- 在
项目>属性> Java Build Path
,添加库如下所示:
- 在
I am getting the error with following two imports in 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.
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).
There is no problem with other javafx related import statements, such as
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.input.MouseEvent;
I had the same problem, until I installed the JDK 1.8.0_60. That's right, installing the latest JDK helped!
After you install the latest JDK, change the settings on the Eclipse There are two steps to the process:
Select the appropriate JRE in
Eclipse > Preferences > Java > Installed JREs
as shown here:- In
Project > Properties > Java Build Path
, Add Library as depicted below:
- In
这篇关于导入javafx.scene.control.Alert无法解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!