I 'm looking for a solution to my problem a long time , I do not find anything to help me, i need to create exe from my app, when I compile it works , however when I try to generate the exe it give me a exception:
Caused by: java.lang.IllegalStateException: Location is not set.
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
at br.nivelamento.MainApp.initRootLayout(Unknown Source)
at br.nivelamento.MainApp.start(Unknown Source)
at 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 do arquivo fxml.
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("view/RootLayout.fxml"));
rootLayout = (BorderPane) loader.load();
// Mostra a 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 anyone help me? thanks