1
I’m trying to run a .jar
outside the eclipse and is returning the following ERROR:
C: Risc>java -jar Graphicalreport.jar Exception in Application start method Exception in thread "main" java.lang.reflect.Invocationtargetexception at sun.reflect.Nativemethodaccessorimpl.invoke0(Native Method) at sun.reflect.Nativemethodaccessorimpl.invoke(Unknown Source) at sun.reflect.Delegatingmethodaccessorimpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.Jdt.internal.jarinjarloader.JarRsrcLoader.main(Jarrsrcloa der.java:58) Caused by: java.lang.Runtimeexception: Exception in Application start method at com.sun.javafx.application.Launcherimpl.launchApplication1(Unknown So urce) at com.sun.javafx.application.Launcherimpl.lambda$launchApplication$155( Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.Illegalstateexception: Location is not set. javafx.fxml.Fxmlloader.loadImpl(Unknown Source) javafx.fxml.Fxmlloader.load(Unknown Source) at br.ind.risc.application.Reportmain.initRootLayout(Reportmain.java:59) at br.ind.risc.application.Reportmain.start(Reportmain.java:46) at com.sun.javafx.application.Launcherimpl.lambda$launchApplication1$162 (Unknown Source) at com.sun.javafx.application.Platformimpl.lambda$runAndWait$175(Unknown Source) at com.sun.javafx.application.Platformimpl.lambda$null$173(Unknown Sourc and) at java.security.Accesscontroller.doPrivileged(Native Method) at com.sun.javafx.application.Platformimpl.lambda$runLater$174(Unknown S gold) at com.sun.Glass.ui.Invokelaterdispatcher$Future.run(Unknown Source) at com.sun.Glass.ui.win.WinApplication. _runLoop(Native Method) at com.sun.Glass.ui.win.WinApplication.lambda$null$148(Unknown Source)
Init method.
/**
* inicializa o layout
*/
public void initRootLayout() {
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(ReportMain.class.getResource(" /br/ind/risc/view/RootLayout.fxml"));
rootLayout = (AnchorPane) loader.load(); //o erro está aqui.
Scene scene = new Scene(rootLayout);
primaryStage.setScene(scene);
primaryStage.centerOnScreen();
primaryStage.show();
} catch (IOException e) {
e.printStackTrace();
}
}