某些JavaFX导入无法在Eclipse中解析 [英] Some JavaFX Imports Cannot Be Resolved in Eclipse

查看:8396
本文介绍了某些JavaFX导入无法在Eclipse中解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个小型JavaFX库,并遇到导入的一些问题。我一直在做我的程序设计在我的电脑和我的笔记本电脑只是托管在Dropbox上的Eclipse工作区,一切工作正常。我在两台机器上安装了e(fx)剪辑,并且已经在几个月内制作了一个JavaFX程序,没有任何问题。



现在,我最近开始了一个新项目我的笔记本电脑也工作正常;然而,当我去我的电脑,我发现了一堆导入_____不能解决错误。



奇怪的是,大多数javafx类导入罚款,它只是似乎在 javafx.scene.control 包中的一些类有问题。在一个类中,我已经到目前为止,我导入这些JavaFX类:

  import javafx.application.Platform; 
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.DialogPane;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.stage.FileChooser;

它们都工作正常,除了三个: javafx.scene.control.ButtonType javafx.scene.control.Dialog javafx.scene.control.DialogPane



我做了相当多的研究,尝试了下面的没有成功:




  • 卸载并重新安装e(fx)剪辑

  • 手动将jfxrt.jar文件添加到项目

  • 清理,重建和刷新

  • 从创建路径中删除JRE并重新添加

  • 使用New> JavaFX Project重建项目并复制代码



似乎没有什么工作,我不明白包中的一些类可能在一个电脑。有没有人有这个解决方案?

解决方案

好吧,我想出了大约5分钟后发布问题...课程。



我通过我在两台计算机上的程序和功能下安装的Java版本。他们看起来是一样的,但我意识到我的笔记本电脑是在Java 8u40,而我的电脑是Java 8u25。我看过javafx.scene.control.Dialog的JavaDocs,当然,它被标记为 @since JavaFX 8u40 ,所以我现在安装新的JDK。 p>

I am creating a small JavaFX library and have run into some issues with the imports. I have been doing my programming on both my PC and my laptop by just hosting the Eclipse Workspace on Dropbox and everything was working fine. I installed e(fx)clipse on both machines and have been making a JavaFX program for a couple months now with no issues.

Now, I recently started a new project on my laptop that was also working fine; however, when I went to my PC, I discovered a bunch of "The import _____ cannot be resolved" errors.

The weird thing is, most of the javafx classes are importing fine, it just seems that some classes in the javafx.scene.control package are having issues. In the one class I have so far, I am importing these JavaFX classes:

import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.DialogPane;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.stage.FileChooser;

They all work fine except for three: javafx.scene.control.ButtonType, javafx.scene.control.Dialog, and javafx.scene.control.DialogPane.

I have done quite a bit of research and tried the following with no success:

  • Uninstalled and reinstalled e(fx)clipse
  • Manually added the jfxrt.jar file to the project
  • Cleaned, rebuilt, and refreshed the project several times
  • Removed the JRE from the build path and re-added it
  • Recreated the project using New>JavaFX Project and copying the code over

Nothing seems to be working and I do not understand how just some classes in the package could be missing on one computer. Does anybody have a solution for this?

解决方案

Okay well I figured this out about 5 minutes after posting the question... of course.

I looked through my installed Java builds under Program and Features on both computers. They looked the same, but I realized that my laptop is on Java 8u40, while my PC is on Java 8u25. I looked at the JavaDocs for javafx.scene.control.Dialog and, sure enough, it is labelled as @since JavaFX 8u40 so I am installing the new JDK now.

这篇关于某些JavaFX导入无法在Eclipse中解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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