简体   繁体   English

如何在 Java 中修复“模块 javafx.graphics 不会“打开 com.sun.javafx.text”到未命名模块”的问题?

[英]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. 和eclipse ide。 When I run my code it should create a pane a textfield and some buttons. 当我运行我的代码时,它应该创建一个窗格、一个文本字段和一些按钮。 It just creates the pane and then I get an error 它只是创建窗格,然后我收到一个错误

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

Here is my main class这是我的主课

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.

相关问题 卡在 javafx.graphics 上不会将 com.sun.javafx.sg.prism 导出到未命名模块 - stuck on javafx.graphics does not export com.sun.javafx.sg.prism to unnamed module 无法访问类 com.sun.javafx.util.Utils(在模块 javafx.graphics 中)-JavaFX 和 Eclipse - Cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) - JavaFX & Eclipse 仍然收到此错误:无法访问类 com.sun.javafx.print.Units(在模块 javafx.graphics 中) - Still getting this error: Cannot access class com.sun.javafx.print.Units (in module javafx.graphics) 模块 java 的问题“模块 'mp3player' 从 'javafx.graphics' 和 'javafx.graphics' 读取 package 'javafx.animation'” - Problem with modules java “Module 'mp3player' reads package 'javafx.animation' from both 'javafx.graphics' and 'javafx.graphics'” 如何修复 Android Studio 中的“module java.base does not "opens java.io" to unnamed module'' 错误? - How to fix the ''module java.base does not "opens java.io" to unnamed module '' error in Android Studio? LdapCtxFactory 因为模块 java.naming 不导出 com.sun.jndi.ldap 到未命名的模块 - LdapCtxFactory because module java.naming does not export com.sun.jndi.ldap to unnamed module 模块 jdk.compiler 不会“打开 com.sun.tools.javac.processing”到未命名的模块 @4bae33a6 - module jdk.compiler does not “opens com.sun.tools.javac.processing” to unnamed module @4bae33a6 包 'com.sun.webkit.dom' 在模块 'javafx.web' 中声明,该模块不会将其导出到模块 - Package 'com.sun.webkit.dom' is declared in module 'javafx.web', which does not export it to module 尝试在 Windows 上的 FTPS 中连接时 Talend 作业失败“模块 java.base 不会”打开 sun.security.ssl“到未命名的模块” - Talend jobs when trying to connect in FTPS on Windows fails “module java.base does not ”opens sun.security.ssl“ to unnamed module” 为什么我会收到“来自模块 javafx.graphics 的类型 GraphicsContext 可能由于缺少‘需要传递’而无法被客户端访问”警告? - why do I get "The type GraphicsContext from module javafx.graphics may not be accessible to clients due to missing 'requires transitive'" warning?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM