找不到javafx.controls JavaFX 11/JDK 11.0.1 [英] javafx.controls could not be found JavaFX 11 / JDK 11.0.1
问题描述
我正在使用InteliJ,已经研究了似乎对其他所有人都适用的所有其他解决方案.我遇到错误:
I am using InteliJ, I've gone through all other solutions that seem to work for everybody else. I was getting an error:
Caused by: java.lang.IllegalAccessError: class com.sun.javafx.fxml.FXMLLoaderHelper (in unnamed module @0x5782d366) cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.util to unnamed module @0x5782d366
然后我将以下内容添加到运行配置中的VM选项:
I then added the following to VM options in the run config:
--module-path="C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib" \
--add-modules=javafx.controls \
--add-exports=javafx.graphics/com.sun.javafx.util=ALL-UNNAMED \
--add-exports=javafx.base/com.sun.javafx.reflect=ALL-UNNAMED \
--add-exports=javafx.base/com.sun.javafx.beans=ALL-UNNAMED \
--add-exports=javafx.graphics/com.sun.glass.utils=ALL-UNNAMED \
--add-exports=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED
那似乎可以部分解决问题?但是,当我尝试运行此代码时,却没有得到完整的堆栈错误信息,我得到了以下三行内容:
That seemed to partially fix the problem? Howerver when I try to run this I don't get a whole stack trace of errors, I get these three lines:
"C:\Program Files\Java\jdk-11.0.1\bin\java.exe" \
--module-path=C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib \
--add-modules=javafx.controls,javafx.fxml \
--add-exports=javafx.graphics/com.sun.javafx.util=ALL-UNNAMED \
--add-exports=javafx.base/com.sun.javafx.reflect=ALL-UNNAMED \
--add-exports=javafx.base/com.sun.javafx.beans=ALL-UNNAMED \
--add-exports=javafx.graphics/com.sun.glass.utils=ALL-UNNAMED \
--add-exports=javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED \
--add-modules javafx.base,javafx.graphics \
--add-reads javafx.base=ALL-UNNAMED \
--add-reads javafx.graphics=ALL-UNNAMED \
"-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3\lib\idea_rt.jar=60572:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3\bin" \
-Dfile.encoding=UTF-8 \
-classpath C:\Users\mresp_000\Desktop\Business\Code\VirtualBeats\out\production\VirtualBeats;\
C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib\src.zip;\
C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib\javafx-swt.jar;\
C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib\javafx.web.jar;\
C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib\javafx.base.jar;\
C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib\javafx.fxml.jar;\
C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib\javafx.media.jar;\
C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib\javafx.swing.jar;\
C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib\javafx.controls.jar;\
C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib\javafx.graphics.jar \
-p C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib\javafx.base.jar;\
C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib\javafx.graphics.jar \
virtualbeats.Main
Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.controls not found
Process finished with exit code 1
当我在VM选项中仅添加以下内容时,我会遇到相同的错误:
I get the same error when I only put in the following to the VM options:
--module-path="C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib"
--add-modules=javafx.controls,javafx.fxml
这是我的运行选项的图片(我已勾选并取消勾选) 包含提供的作用域的依赖项"框,均无效.
Here is a picture of my run options (I have ticked and un-ticked the "include dependencies withg provided scope" box, neither work.
库指向正确的位置,我尝试重建该项目,但没有任何效果.当我转到命令行并键入:
The library is pointing to the right place and I've tried rebuilding the project, nothing is working. When I go to my command line and type:
dir "C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib"
我得到以下输出:
因此,这里的所有内容都是事实,并指向它需要指向的确切位置.将.jar扩展名添加到add-module也没有任何作用.
So everything is infact there and pointing to the exact location it needs to be pointing to. Adding the .jar extension to the add-module also does nothing.
推荐答案
尝试:
--module-path C:\Users\mresp_000\Desktop\Business\Code\SDKS\javafx-sdk-11.0.1\lib --add-modules=ALL-MODULE-PATH
作为运行配置,我不知道,也许可以用吗?
as Runconfiguration, I don't know, maybe it works?
这篇关于找不到javafx.controls JavaFX 11/JDK 11.0.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!