无法访问JavaFX类"WebPage"在IntelliJ-IDEA中 [英] Cannot access JavaFX class "WebPage" in IntelliJ-IDEA

查看:186
本文介绍了无法访问JavaFX类"WebPage"在IntelliJ-IDEA中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用JavaFX-11一段时间了. 我在我的项目结构中将JavaFX设置为全局库.我还根据需要在项目的module-info.class文件中添加了所有内部模块.

I've been using JavaFX-11 for a while. I set JavaFX as a Global library in my Project structure. I also added all the modules inside as required in the module-info.class file of my project.

这工作正常,但是现在我需要一个类"WebPage",它位于 javafx.web模块.

This is working fine, but now I need a Class, "WebPage", that's inside the javafx.web module.

具体来说,它位于javafx.web.com.sun.webkit.WebPage中.

Specifically, it's inside javafx.web.com.sun.webkit.WebPage.

但是,我的IDE Intellij-IDEA无法访问它. 当我输入整个路径时,工具提示会说: 包'com.sun.webkit'在javafx.web中声明,该包不会将其导出到模块项目名.

However, my IDE, Intellij-IDEA doesn't access it. When I type the whole path the tooltip says that, Package 'com.sun.webkit' is declared in javafx.web, which does not export it to the module projectname.

我不太熟悉模块文件的工作方式,但是我注意到javafx.web中也有一个模块信息文件.但是,它是只读的.如何访问此内容?

I'm not so familiar with how module files work, but I noticed there is also a module info file inside javafx.web. However, it's read-only. How can I access this content?

推荐答案

但是我注意到javafx.web中也有一个模块信息文件.但 它是只读的.我如何访问此内容?

but i noticed there is a module info file inside javafx.web also. But its read only. how can i acces this content?

要收集的几个点:-

  1. 您要查找的类必须是您导入的库中的module-info.class,因此它将是一个只读文件.

  1. The class you are looking for must be a module-info.class from the library you've imported and hence it would be a read-only file.

com.sun.*类已被弃用,最终用户不应使用,因此自Java-9起它们已被删除或已成为JDK内部API(未导出).

The com.sun.* classes are deprecated and shouldn't be used by end users, hence they've been removed or made JDK internal APIs(not exported) since Java-9.

尝试依赖于此类的代码来迁移代码.同时,要使这项工作仍然有效的临时解决方案是使用VM参数

Try migrating your code relying on such classes. In the meanwhile a temporary solution to still make this work would be to use a VM argument

--add-exports javafx.web/com.sun.webkit=projectname

最后一个参数是在项目的 module-info.java 中声明的模块名称.

where the last argument is your module name as declared in the module-info.java of your project.

这篇关于无法访问JavaFX类"WebPage"在IntelliJ-IDEA中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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