Erro ao executar o código no netbeans (JAVAFX)

4 respostas
javafxjava
E

O erro é o seguinte (lembrando que só acontece no javaFX, no swing funciona tudo normal):

Exception in Application start method

java.lang.reflect.InvocationTargetException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)

at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)

Caused by: java.lang.RuntimeException: Exception in Application start method

at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)

at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)

at java.lang.Thread.run(Thread.java:745)

Caused by: java.lang.NullPointerException: Location is required.

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3207)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)

at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)

at teste.Teste.start(Teste.java:22)

at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)

at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)

at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)

at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)

at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)

 1 more

Exception running application teste.Teste

C:\Users\Evandro Casanova\Documents\NetBeansProjects\teste\nbproject\build-impl.xml:1052: The following error occurred while executing this line:

C:\Users\Evandro Casanova\Documents\NetBeansProjects\teste\nbproject\build-impl.xml:806: Java returned: 1

4 Respostas

J

Parece que ele não encontrou o arquivo FXML

E

alguma dica do que fazer?

J

Dentro do netbeans esta rodando corretamente ?

A

Posta o código da classe principal, que contém o método main e start! O problema está no método start. O caminho do arquivo FXML não deve estar correto.

Criado 20 de agosto de 2018
Ultima resposta 21 de ago. de 2018
Respostas 4
Participantes 3