在JRE 8中使用JavaFX,“访问限制”错误 [英] Using JavaFX in JRE 8, “Access restriction” error

查看:149
本文介绍了在JRE 8中使用JavaFX,“访问限制”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的新java 8项目中尝试使用javafx相关类时,我从eclipse中获得了访问限制错误。到目前为止,我能找到的唯一解决方案是告诉eclipse忽略访问限制,但我对此并不满意。
错误示例:

When trying to use javafx related classes in my new java 8 project I get an access restriction error from eclipse. So far the only 'solution' I've been able to find is to tell eclipse to ignore the access restriction, but I am not satisfied with that. An example of the error:

Access restriction: The type Pane is not accessible due to 
restriction on required library C:\Program Files\Java\jre8_0\lib\ext\jfxrt.jar

我正在使用Eclipse Kepler和Eclipse 8的Eclipse JDT补丁。

I'm using Eclipse Kepler with the Eclipse JDT patch for java 8.

这似乎与JavaFX不是一个问题有关JavaSE执行环境的一部分。

This seems to be an issue related to the fact that JavaFX is not a part of the JavaSE execution environment.

我现在很困惑,因为根据 http://en.wikipedia.org/wiki/JavaFX javaFX是JavaSE的一部分。是否有可能Eclipse没有认识到它是javaSE的一部分?

I am now toughly confused as according to http://en.wikipedia.org/wiki/JavaFX javaFX is a part of the JavaSE. Is it possible that Eclipse is not recognizing that it is a part of the javaSE?

推荐答案

从Eclipse的角度来看错误是完全正确的,因为JavaFX来自扩展类路径,并且在所有Java8 VM上都不可用(例如ibm!)。

From the Eclipse Point of view the error is totally correct because JavaFX is coming from the extension classpath and is not available on ALL Java8 VMs (e.g. ibm!).

如上所述,您可以通过添加访问来抑制这些警告-rules或恕我直言,最好的解决方案是安装e(fx)clipse,它会自动为您和旁边提供这一功能,甚至可以为您提供JavaFX CSS和FXML的工具。

As outlined you can suppress those warnings by add access-rules or IMHO the best solution is to install e(fx)clipse which does this automatically for you and beside that even provides you tooling for JavaFX CSS and FXML.

你可以从 http://efxclipse.bestsolution.at/install.html 获取一个整合的包

You can grab an all in one package from http://efxclipse.bestsolution.at/install.html

这篇关于在JRE 8中使用JavaFX,“访问限制”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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