java - JavaFX throws LoadException inside .fxml file -
i pretty new java have php , javascript background. i'm trying build interactive javafx application basic log in, data handling , log out - straight forward.
at moment have stumbled upon problem not understand. develop on 2 different environments - @ home , @ work. started project @ home no issues installing jdk , intellij , setting project configuration. followed same steps on work computer (os x - same home computer) cannot run application intellij.
fxml file:
<?xml version="1.0" encoding="utf-8"?> <?language javascript?> <?import java.net.*?> <?import javafx.geometry.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.text.*?> <gridpane fx:controller="carmanager.login.logincontroller" xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10" styleclass="root"> <padding> <insets top="25" right="25" bottom="10" left="25"/> </padding> <stylesheets> <url value="@../../fxml_styles.css" /> </stylesheets> <fx:script source="../../fxml_scripts.js"></fx:script> <!--<gridlinesvisible>true</gridlinesvisible>--> <text id="welcome-text" text="welcome" gridpane.columnindex="0" gridpane.rowindex="0" gridpane.columnspan="2"/> <label text="user name:" gridpane.columnindex="0" gridpane.rowindex="1"/> <textfield fx:id="usernamefield" gridpane.columnindex="1" gridpane.rowindex="1"/> <label text="password:" gridpane.columnindex="0" gridpane.rowindex="2"/> <passwordfield fx:id="passwordfield" gridpane.columnindex="1" gridpane.rowindex="2"/> <hbox spacing="10" alignment="bottom_right" gridpane.columnindex="1" gridpane.rowindex="4"> <button text="sign in" onaction="#trylogin"/> </hbox> <hbox spacing="10" alignment="bottom_right" gridpane.columnindex="1" gridpane.rowindex="5"> <text fx:id="actiontarget" gridpane.columnindex="1" gridpane.rowindex="5"/> </hbox> </gridpane>
main class:
package carmanager; import carmanager.login.logincontroller; import javafx.application.application; import javafx.fxml.fxmlloader; import javafx.scene.parent; import javafx.scene.scene; import javafx.stage.stage; public class main extends application{ @override public void start(stage primarystage) throws exception { parent root = fxmlloader.load(logincontroller.class.getresource("login.fxml")); primarystage.settitle("car manager - welcome"); primarystage.setscene(new scene(root, 400, 375)); primarystage.show(); } public static void main(string[] args) { launch(args); } }
error:
exception in application start method exception in thread "main" 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:745) caused by: javafx.fxml.loadexception: /users/erik/projects/car-manager-i200/out/carmanager/login/login.fxml:22 @ javafx.fxml.fxmlloader.constructloadexception(fxmlloader.java:2601) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:2579) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:2441) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:3214) @ 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) @ carmanager.main.start(main.java:15) @ 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) caused by: java.lang.runtimeexception: java.lang.reflect.invocationtargetexception @ com.sun.javafx.fxml.beanadapter.put(beanadapter.java:262) @ com.sun.javafx.fxml.beanadapter.put(beanadapter.java:54) @ javafx.fxml.fxmlloader$element.applyproperty(fxmlloader.java:512) @ javafx.fxml.fxmlloader$element.processvalue(fxmlloader.java:363) @ javafx.fxml.fxmlloader$element.processpropertyattribute(fxmlloader.java:325) @ javafx.fxml.fxmlloader$element.processinstancepropertyattributes(fxmlloader.java:235) @ javafx.fxml.fxmlloader$valueelement.processendelement(fxmlloader.java:767) @ javafx.fxml.fxmlloader.processendelement(fxmlloader.java:2823) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:2532) ... 14 more caused by: 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) @ sun.reflect.misc.trampoline.invoke(methodutil.java:71) @ 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.reflect.misc.methodutil.invoke(methodutil.java:275) @ com.sun.javafx.fxml.beanadapter.put(beanadapter.java:258) ... 22 more caused by: java.lang.nullpointerexception @ com.sun.javafx.font.macfontfinder.populatefontfilenamemap(macfontfinder.java:99) @ com.sun.javafx.font.prismfontfactory.getfullnametofilemap(prismfontfactory.java:1740) @ com.sun.javafx.font.prismfontfactory.getfontresource(prismfontfactory.java:469) @ com.sun.javafx.font.logicalfont.getslot0resource(logicalfont.java:194) @ com.sun.javafx.font.logicalfont.getdefaultaamode(logicalfont.java:409) @ com.sun.javafx.font.logicalfont.getstrike(logicalfont.java:413) @ com.sun.javafx.font.prismfont.getstrike(prismfont.java:73) @ com.sun.javafx.text.prismtextlayout.setcontent(prismtextlayout.java:138) @ javafx.scene.text.text.gettextlayout(text.java:229) @ javafx.scene.text.text.needsfulltextlayout(text.java:184) @ javafx.scene.text.text.access$200(text.java:95) @ javafx.scene.text.text$2.invalidated(text.java:389) @ javafx.beans.property.stringpropertybase.markinvalid(stringpropertybase.java:109) @ javafx.beans.property.stringpropertybase.set(stringpropertybase.java:144) @ javafx.beans.property.stringpropertybase.set(stringpropertybase.java:49) @ javafx.scene.text.text.settext(text.java:370) ... 33 more process finished exit code 1
if remove nested inside gridpane block in fxml file, code compiles , runs without problems. presume may related configuration on work computer because code runs no problems on home computer. question is, how find out issue?
Comments
Post a Comment