1

I got this error when trying to run a program of mine, cannot access class com.sun.javafx.beans.IDProperty and goes

I've tried to google every error I could think of, and none of them worked, even here in stackoverflow I didn't found anything that could help me, that's why I'm asking a specific one

I believe the error is in this class, because it started to happen since I created it.

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");

    }
}

This is the error that shows up when I try to run the program

"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

  • 1
    You need to make sure the `javafx.fxml` module is on the modulepath. If you aren't using modules yourself add `--add-modules javafx.fxml` to your VM arguments. This guide may help: https://openjfx.io/openjfx-docs/#IDE-Intellij – Slaw Jun 18 '19 at 16:22
  • Related questions: https://stackoverflow.com/questions/54291958/javafx-11-illegalaccesserror-when-creating-label and https://stackoverflow.com/questions/54138287/getting-java-lang-reflect-invocationtargetexception-while-adding-a-button-to-lay – Slaw Jun 18 '19 at 16:26

0 Answers0