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

查看:27
本文介绍了在 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 FilesJavajre8_0libextjfxrt.jar

我将 Eclipse Kepler 与 Java 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!).

如上所述,您可以通过添加访问规则或恕我直言来抑制这些警告,最好的解决方案是安装 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 获取多合一软件包

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

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