java - JavaFx project compiles with maven but doesnt execute -


this question has answer here:

i'm writting program in java , i'm using javafx gui. until today i've using javafx stand alone code , runs smoothly. i've decided start using maven , project doesnt compile nor run or execute.

    exception in application start method java.lang.reflect.invocationtargetexception     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:498)     @ com.sun.javafx.application.launcherimpl.launchapplicationwithargs(launcherimpl.java:389)     @ com.sun.javafx.application.launcherimpl.launchapplication(launcherimpl.java:328)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:498)     @ sun.launcher.launcherhelper$fxhelper.main(launcherhelper.java:767) caused by: java.lang.runtimeexception: exception in application start method     @ com.sun.javafx.application.launcherimpl.launchapplication1(launcherimpl.java:917)     @ com.sun.javafx.application.launcherimpl.lambda$launchapplication$155(launcherimpl.java:182)     @ java.lang.thread.run(thread.java:748) caused by: java.lang.nullpointerexception: location required.     @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:3207)     @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:3175)     @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:3148)     @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:3124)     @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:3104)     @ javafx.fxml.fxmlloader.load(fxmlloader.java:3097)     @ main.java.main.start(main.java:19)     @ com.sun.javafx.application.launcherimpl.lambda$launchapplication1$162(launcherimpl.java:863)     @ com.sun.javafx.application.platformimpl.lambda$runandwait$175(platformimpl.java:326)     @ com.sun.javafx.application.platformimpl.lambda$null$173(platformimpl.java:295)     @ java.security.accesscontroller.doprivileged(native method)     @ com.sun.javafx.application.platformimpl.lambda$runlater$174(platformimpl.java:294)     @ com.sun.glass.ui.invokelaterdispatcher$future.run(invokelaterdispatcher.java:95)     @ com.sun.glass.ui.win.winapplication._runloop(native method)     @ com.sun.glass.ui.win.winapplication.lambda$null$148(winapplication.java:191)     ... 1 more exception running application main.java.main 

this main class:

public static void main(string[] args) {     launch(args); }  @override public void start(stage primarystage) throws exception {     parent root = fxmlloader.load(getclass().getresource("../fxml/authenticationform.fxml"));     primarystage.settitle("gym master 1000");     primarystage.setscene(new scene(root));     primarystage.show();     primarystage.setresizable(false);     primarystage.centeronscreen();      root.getchildrenunmodifiable(); } 

i have used maven on other projects never javafx. do?

first of sure .fxml file in same directory main class, , use complete path in .getresource("complete path") , not getresource("../fxml/authenticationform.fxml")) because .. ins´t valid.

also can use :

parent root = fxmlloader.load(getclass().getclassloader().getresource("completepath")); 

instead:

parent root = fxmlloader.load(getclass().getresource("../fxml/authenticationform.fxml")); 

for more information, can here , here. james_d information.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -