Attention, pour lire un fichier dans le JAR courant :
Il faut utiliser :
Mais ne fonctionne pas en mode non packagé, alors tu peux faire une classe utilitaire du style :Code:
1
2 MaClasseCourante.class.getRessourceAsStream("/fr/bla.wav");
Code:
1
2
3
4
5
6
7
8
9
10
11 static public InputStream getInputStream(String file) throws FileNotFoundException { InputStream iStream = null; try { iStream = new FileInputStream(System.getProperty("user.dir" ) + "/" + file); return iStream; } catch(FileNotFoundException e) { return MillieGUIUtils.class.getResourceAsStream("/" + file); } }