Build JavaFX app using ant -
i 'm looking solution problem long time , not find me, need create exe app, when compile works , when try generate exe give me exception:
caused by: java.lang.illegalstateexception: location not set. @ javafx.fxml.fxmlloader.loadimpl(unknown source) @ javafx.fxml.fxmlloader.load(unknown source) @ br.nivelamento.mainapp.initrootlayout(unknown source) @ br.nivelamento.mainapp.start(unknown source) @ com.sun.javafx.application.launcherimpl.lambda$launchapplication1$163 (unknown source)
build.xml
<project name="nivelamento" default="do-deploy" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant"> <target name="init-fx-tasks"> <path id="fxant"> <filelist> <file name="${java.home}\..\lib\ant-javafx.jar" /> <file name="${java.home}\lib\jfxrt.jar" /> </filelist> </path> <taskdef resource="com/sun/javafx/tools/ant/antlib.xml" uri="javafx:com.sun.javafx.tools.ant" classpathref="fxant" /> </target> <fx:resources id="appres"> <fx:fileset dir="dist" includes="nivelamento.jar" /> <fx:fileset dir="dist" includes="libs/*" /> </fx:resources>
mainapp.class
package br.nivelamento; public class mainapp extends application { private stage primarystage; private borderpane rootlayout; @override public void start(stage primarystage) { this.primarystage = primarystage; this.primarystage.settitle("nivelamentoapp"); setuseragentstylesheet(stylesheet_caspian); initrootlayout(); } public static void main(string[] args){ mainapp.launch(mainapp.class, args); } public void initrootlayout() { try { // carrega o root layout arquivo fxml. fxmlloader loader = new fxmlloader(); loader.setlocation(getclass().getresource("view/rootlayout.fxml")); rootlayout = (borderpane) loader.load(); // mostra scene (cena) contendo o root layout. scene scene = new scene(rootlayout); primarystage.setscene(scene); // dá ao controller o acesso ao main app. rootlayoutcontroller controller = loader.getcontroller(); controller.setmainapp(this); //liga o hibernate jpautil.getentitymanager(); primarystage.show(); } catch (ioexception e) { e.printstacktrace(); } }
can me? thanks
after many attempts succeeded, error in loader.setlocation (mainapp.class.getresource ("view / rootlayout.fxml")); rootlayout.fxml see not real name real name rootlayout.fxml repairing uppercase character solved problem
Comments
Post a Comment