简体   繁体   English

Java 11+网景JSObject

[英]Java 11 + netscape JSObject

I have an old project I am migrating from Java 8 to Java 11.我有一个旧项目,我正在从 Java 8 迁移到 Java 11。

When compiling the project I use these VM options:编译项目时,我使用这些 VM 选项:

--module-path /path/to/javafx-sdk-11.0.2/lib --add-modules=javafx.controls,javafx.fxml,javafx.swing,javafx.graphics,javafx.media,javafx.web --add-reads javafx.graphics=ALL-UNNAMED --add-opens javafx.controls/com.sun.javafx.charts=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.iio=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.iio.common=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.css=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.runtime=ALL-UNNAMED

I don't know why but when launching the project in Intellij it throws the following erro:我不知道为什么,但是在 Intellij 中启动项目时会引发以下错误:

Error:(4, 27) java: package netscape.javascript does not exist错误:(4, 27) java: package netscape.javascript 不存在

Error:(68, 19) java: cannot find symbol symbol: class JSObject错误:(68、19)java:找不到符号符号:class JSObject

But as far as I know, JSObject is still available in Java11, right?但据我所知,JSObject 在 Java11 中仍然可用,对吧? https://docs.oracle.com/en/java/javase/11/docs/api/jdk.jsobject/netscape/javascript/JSObject.html I see one deprecated method but the class is still available. https://docs.oracle.com/en/java/javase/11/docs/api/jdk.jsobject/netscape/javascript/JSObject.html I see one deprecated method but the class is still available.

What can be the issue?可能是什么问题?

I had a similar problem, I had to add this:我有一个类似的问题,我不得不添加这个:

--add-modules jdk.jsobject --add-exports=javafx.web/com.sun.javafx.webkit=ALL-UNNAMED

Not sure if you need the --add-exports part, but probably the first part is important, since the jdk.jsobject module is what contains the netscape.javascript.JSObject class.不确定是否需要 --add-exports 部分,但可能第一部分很重要,因为 jdk.jsobject 模块包含 netscape.javascript.JSObject class。

Hope that helps a bit...希望那有所帮助...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM