[英]How to fix " module javafx.graphics does not "opens com.sun.javafx.text" to unnamed module" problem in Java?
I am using我在用
jdk12,javafx12
and eclipse ide.
I tried using我尝试使用
jdk11
I got the same error
I wrote these to我把这些写给
VM
arguments:
--module-path /home/beyza/openjfx-12.0.1_linux-x64_bin-sdk/javafx-sdk- 12.0.1/lib --add-modules javafx.controls --add-modules javafx.base --add-modules javafx.graphics --add-modules javafx.fxml --add-modules javafx.media --add-exports javafx.graphics/com.sun.javafx.util=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.sg.prism=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.util=ALL-UNNAMED --add-exports javafx.base/com.sun.javafx.logging=ALL-UNNAMED --add-exports javafx.graphics/com.sun.prism=ALL-UNNAMED --add-exports javafx.graphics/com.sun.glass.ui=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.geom.transform=ALL- UNNAMED --add-exports javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED --add-exports javafx.graphics/com.sun.glass.utils=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.font=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED --add-exports javafx.controls/com.sun.javafx.scene.control=ALL- UNNAMED --add-exports javafx.graphics/com.sun.javafx.scene.input=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.geom=ALL-UNNAMED --add-exports javafx.graphics/com.sun.prism.paint=ALL-UNNAMED --add-exports javafx.graphics/com.sun.scenario.effect=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.text=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.geom=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.scene.text=ALL-UNNAMED --add-opens javafx.graphics/javafx.scene=ALL-UNNAMED --add-opens javafx.graphics/javafx.scene.text=ALL-UNNAMED
I got this error我收到这个错误
Exception in thread "JavaFX Application Thread" java.lang.ExceptionInInitializerError Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private int com.sun.javafx.text.PrismTextLayout.getLineIndex(float) accessible: module javafx.graphics does not "opens com.sun.javafx.text" to unnamed module
The right answer is --add-opens javafx.graphics/com.sun.javafx.text=ALL-UNNAMED
to VM options.正确答案是
--add-opens javafx.graphics/com.sun.javafx.text=ALL-UNNAMED
到 VM 选项。
But anyone can avoid those VM options if write a simple launcher class like this:但是如果编写一个像这样的简单启动器类,任何人都可以避免这些 VM 选项:
public class AppLauncher {
public static void main(String[] args) {
YourAppMainClassNameHere.main(args);
}
}
And run the app through this.并通过这个运行应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.