Bonjour à tous,

J'ai un petit problème d'ordre de lancement de fichier .jar de mon application. Le lancement à partir de mon IDE s'effectue sans problèmes et tout fonctionne.

Cependant le lancement avec le fichier .jar généré par l'artifact de l'IDE me sort cette erreur suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
Exception in Application start method
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
        at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$1(LauncherImpl.java:182)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Location is not set.
        at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2434)
        at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
        at main.MainClass.initializePrincipalContainer(MainClass.java:319)
        at main.MainClass.start(MainClass.java:308)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$3(WinApplication.java:177)
        ... 1 more
Exception running application main.MainClass
En voyant l'erreur de location ligne 319 qu'est la suivante :
campaignContainer = (BorderPane) loader.load();
de :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
private BorderPane campaignContainer;
private Stage campaignStage;
 
    public void start(Stage primaryStage) throws Exception{
        campaignStage = primaryStage;
        campaignStage.setTitle("Combination Companion");
        initializeArraylists();
        initializePrincipalContainer();
        initializeCampaignView();
    }
 
    public void initializePrincipalContainer(){
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getResource("../container/CampaignContainer.fxml"));
        try {
            campaignContainer = (BorderPane) loader.load();
            Scene scene = new Scene(campaignContainer);
            campaignStage.getIcons().add(new Image("pictures/ico.jpg"));
            campaignStage.setScene(scene);
            CampaignContainerMapping controller = loader.getController();
            controller.setMainApp(this);
            campaignStage.show();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
Le problème vient-il de l'endroit duquel je lance mon application avec le fichier .jar? j'ai essayé de le placer au même endroit que ma classe main mais rien n'a changé.

Je ne comprends pas très bien les erreurs de locations. Pourriez vous m'éclaircir sur ce point ?

Merci d'avance