导入javafx.scene.control.Alert无法解析 [英] The import javafx.scene.control.Alert cannot be resolved

查看:5849
本文介绍了导入javafx.scene.control.Alert无法解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  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
上的设置有两个步骤:


  1. Eclipse>中选择适当的JRE首选项> Java>安装的JRE 如下所示:


    1. 项目>属性> 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:

  1. Select the appropriate JRE in Eclipse > Preferences > Java > Installed JREs as shown here:

    1. In Project > Properties > Java Build Path, Add Library as depicted below:

这篇关于导入javafx.scene.control.Alert无法解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆