bonjour,
je lance la commande suivante avec getRuntime().exec
la commande est "cmd.exe /c notepad++ file.txt" en fait c'est pour ouvrir un editeur externe (notepad++ par exemple).

cela fonctionne bien si il n'y a pas d'erreur, mais je n'arrive pas a savoir si il y a une erreur.

si par exemple j'essaie (voir exemple) "cmd.exe /c sse test.txt"
j'ai essayer exitValue mais j'ai une erreur illegalthreadstateexception : process has not exited

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
 
import java.io.IOException;
 
public class testframe {
 
	public static void main(String[] args) {
		try {
			Process k = Runtime.getRuntime().exec(
					"cmd.exe /c  sse test.txt");
			k.exitValue();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
 
}
comment savoir si il y a une erreur ou non ?

merci

a+