Bonjour,

J'ai développé un lanceur (launcher) de jeux-vidéos que j'ai pu exporter à partir d'Eclipse et celui-ci fonctionne bien.

Ensuite, j'ai modifié le launcher afin que celui-ci lise un fichier de configuration permettant de paramétrer les liens, l'emplacement des images...
Sous Eclipse ça fonctionne mais ce n'est plus le cas une fois l'application exportée.

Voilà ma classe "Start" avant la modification...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
package fr.foox.launchercreator;
 
import java.awt.FontFormatException;
import java.io.IOException;
 
public class Go
{
  public static void main(String[] args) throws FontFormatException, IOException
  {
    new Home();
  }
}
Et la Classe "Start" après la Modification
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
package fr.foox.launchercreator;
 
import java.awt.FontFormatException;
import java.io.IOException;
 
public class Go
{
  public static void main(String[] args) throws FontFormatException, IOException
  {
    new ConfigManager().readConfig();
    new Home();
  }
}
Et ma classe ConfigManager
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package fr.foox.launchercreator;
 
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
 
import org.apache.commons.io.FileUtils;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
 
public class ConfigManager 
{
    private static Map<String, String> config = new HashMap();
    private static Map<String, Image> imgs = new HashMap();
 
    public void readConfig()
    {
        System.out.println("Lecture du fichier config en cours...");
        InputStream is = this.getClass().getResourceAsStream("/fr/foox/launcherCreator/ressources/config.txt");
        Scanner scan = new Scanner(is);
        do{
            String line = scan.nextLine();
            if(line.contains("="))
            {
                config.put(line.split("=")[0], line.split("=")[1]);
            }
        }
        while(scan.hasNextLine());
        scan.close();
        System.out.println("Lecture du fichier config terminé !");
        System.out.println("Lancement du Launcher...");
        System.out.println("Lancement du Launcher...");
        System.out.println("Lancement du Launcher...");
        System.out.println("Lancement du Launcher...");
        System.out.println("Lancement du Launcher...");
        System.out.println("Lancement du Launcher...");
    }
 
    public static String get(String option)
    {
        return config.get(option);
    }
 
    public static void DeleteOldInstallation() throws Exception{
        String dir = Util.getWorkingDirectory().getCanonicalPath().replace(config.get("emplacement"), config.get("123unknownwindowsdir"));
        File f = new File(dir);
        if(f.exists() && f.isDirectory())
        {
            FileUtils.deleteQuietly(f);
        }
    }
 
    public static Image select(String key){
        return imgs.get(key);
    }
 
    public static void put(String key, String img_name)
    {
        try {
            Image img = new Image("fr/foox/launchercreator/ressources/" + img_name);
            imgs.put(key, img);
            System.out.println("Image " + key + " chargée ! ("+img_name+")");
        } catch (SlickException e) {
            System.err.println("Impossible de charger l'image '"+key+"' ("+img_name+")");
        }
    }
 
    private void ObfuscateStandartLogging() 
    {
         System.setOut(new PrintStream(new OutputStream() {
             @Override
             public void write(int arg0) throws IOException {
                 String l = Long.toHexString(Double.doubleToLongBits(Math.random()));
                 System.err.println(l+l+l+l+l+l);
             }
          }));
    }
}
Quelqu'un saurait-il m'indiquer comment faire en sorte que ça fonctionne également après export ?

Merci d'avance pour votre aide.