javafx.controls could not be found JavaFX 11 / JDK 11.0.1

核能气质少年 提交于 2019-12-30 06:33:46

问题


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

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

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"

I get the following output:

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.

来源:https://stackoverflow.com/questions/53617191/javafx-controls-could-not-be-found-javafx-11-jdk-11-0-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!