JavaFX错误“由:java.lang.IllegalAccessError:(...)引起”

时间:2019-06-18 15:46:40

标签: java intellij-idea javafx

尝试运行我的程序时出现此错误,无法访问com.sun.javafx.beans.IDProperty类,并且无法运行

我试图用谷歌搜索所有我能想到的错误,但没有一个起作用,即使在stackoverflow中,我也找不到任何可以帮助我的东西,这就是为什么我要问一个具体的问题

我认为该类错误是因为自创建以来就开始发生这种错误。

package controller;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import principal.Main;

public class perfilTeste {
    Main tela = new Main();

    @FXML
    protected void btnVoltar(ActionEvent evento){
        System.out.println("Voltar - PERFIL");
        tela.mudaTela(2);
    }

    @FXML
    protected void btnSair(ActionEvent evento){
        System.out.println("Sair");
        tela.mudaTela(0);
    }

    @FXML
    protected void btnLimpar(ActionEvent evento){
        System.out.println("Limpar");

    }

    @FXML
    protected void btnEnviar(ActionEvent evento){
        System.out.println("Limpar");

    }
}

这是我尝试运行程序时出现的错误

"C:\Program Files\Java\jdk-12.0.1\bin\java.exe" --module-path C:\Users\Iuri\Documents\Miguel\javaFx\javafx-sdk-11.0.2\lib --add-modules javafx.controls --add-modules javafx.graphics --add-exports=javafx.graphics/com.sun.javafx.util=ALL-UNNAMED --add-exports=javafx.base/com.sun.javafx.reflect=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 2019.1.3\lib\idea_rt.jar=50510:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\Iuri\Documents\Miguel\java\backup\aplicativoTrans\out\production\aplicativoTrans;C:\Users\Iuri\Documents\Miguel\javaFx\javafx-sdk-11.0.2\lib\src.zip;C:\Users\Iuri\Documents\Miguel\javaFx\javafx-sdk-11.0.2\lib\javafx-swt.jar;C:\Users\Iuri\Documents\Miguel\javaFx\javafx-sdk-11.0.2\lib\javafx.web.jar;C:\Users\Iuri\Documents\Miguel\javaFx\javafx-sdk-11.0.2\lib\javafx.base.jar;C:\Users\Iuri\Documents\Miguel\javaFx\javafx-sdk-11.0.2\lib\javafx.fxml.jar;C:\Users\Iuri\Documents\Miguel\javaFx\javafx-sdk-11.0.2\lib\javafx.media.jar;C:\Users\Iuri\Documents\Miguel\javaFx\javafx-sdk-11.0.2\lib\javafx.swing.jar;C:\Users\Iuri\Documents\Miguel\javaFx\javafx-sdk-11.0.2\lib\javafx.controls.jar;C:\Users\Iuri\Documents\Miguel\javaFx\javafx-sdk-11.0.2\lib\javafx.graphics.jar;C:\Users\Iuri\Documents\Miguel\java\ezRequest - Cópia.jar" principal.Main
Exception in Application start method
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
    at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.IllegalAccessError: class javafx.fxml.FXMLLoader$ValueElement (in unnamed module @0x3dba7c2b) cannot access class com.sun.javafx.beans.IDProperty (in module javafx.base) because module javafx.base does not export com.sun.javafx.beans to unnamed module @0x3dba7c2b
    at javafx.fxml.FXMLLoader$ValueElement.processValue(FXMLLoader.java:853)
    at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:759)
    at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2722)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2552)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3237)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3194)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3163)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3136)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3113)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3106)
    at principal.Main.start(Main.java:39)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    ... 1 more
Exception running application principal.Main

Process finished with exit code 1

0 个答案:

没有答案