Je cherche une solution à mon problème depuis longtemps, je ne trouve rien pour m'aider, je dois créer exe depuis mon application, quand je compile ça fonctionne, mais quand j'essaye pour générer l'exe il me donner une exception:Créer une application JavaFX en utilisant ant
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();
}
}
Quelqu'un peut-il m'aider? grâce
En lisant le journal des erreurs 'Causé par: java.lang.IllegalStateException: Location is not set.' it On dirait qu'il y a une erreur avec votre chemin de fichier. Après une recherche google rapide, je suis tombé sur ce [post] (http://stackoverflow.com/questions/17228487/javafx-location-is-not-set-error-message). Je suggère de passer par ce poste en premier puis mettez à jour pour savoir si vous avez réussi à résoudre votre problème. – rze
Mon problème est quand je déploie l'application à exe en utilisant la fourmi, quand je compile en éclipse cela fonctionne – user3576248