Bonjour,
J'ai un probleme pour mettre a jour DYNAMIQUEMENT le classpath voici un exemple :

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
 
public static List<Class> getClassListFromJar(String jar)
			throws IOException {
 
		List<Class> classes = new ArrayList<Class>();
 
		JarFile jfile = null;
 
// ICI tentative de mise a jour du classpath
// je suis un peu dessus parceque ca ne marche et normalement la logique est bonne
		String classPath = System.getProperty("java.class.path");
 
		System.setProperty("java.class.path", classPath
				+ ":/mon/nouveau/path");
 
		System.out.println(classPath);
		System.out.println(System.getProperty("java.class.path"));
 
		try {
			jfile = new JarFile(jar);
			for (Enumeration<JarEntry> entries = jfile.entries(); entries
					.hasMoreElements();) {
				JarEntry element = entries.nextElement();
				String nomFichier = element.getName();
 
				// classes.add(Class.forName(nomFichier.split("\\.")[0]));
 
				if (nomFichier.endsWith(".class")) {
 
					nomFichier = nomFichier.split("\\.")[0]
							.replaceAll("/", ".");
					System.out.println(nomFichier);
					classes.add(Class.forName(nomFichier));
					/*
					 * IPlugin obj = (IPlugin) Class.forName(nomFichier)
					 * .newInstance(); System.out.println(obj.getName());
					 */
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (jfile != null)
				jfile.close();
		}
		return classes;
	}
Alors vous avez une idee ?

merci