Bonjour ,
J'ai une problème dans l'utilisation de Process Builder , en fait , lorsque je tqpe les commandes dans le cmd directement il affiche le résultat attendu mais avec netbeans il affiche "Microsoft Windows [version 10.0.10586]
(c) 2015 Microsoft Corporation. Tous droits r�serv�s "
Voici le code que j'ai utilisé
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 package gato.decoder; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; /** * * @author ASUS */ public class GatoDecoder { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { try { // ProcessBuilder pb = new ProcessBuilder("cmd", "/D", "D:\\PFE\\gatodecoder-1.3.3\\gatodecoder-1.3.3\\exe\\decoderplugincli.exe --d -s \"1440480a240672a88b5745d48315fd5b44ef286ed9964020847d6863f17e0000ebb9b1af26ff7ed2\" -f textfullfield -k 0401f763 -o 4"); final List<String> commands = new ArrayList<String>(); commands.add("cmd.exe"); commands.add("/D"); commands.add("cd D:\\\\PFE\\\\gatodecoder-1.3.3\\\\gatodecoder-1.3.3\\\\exe"); commands.add("decoderplugincli.exe --d -s \\\"1440480a240672a88b5745d48315fd5b44ef286ed9964020847d6863f17e0000ebb9b1af26ff7ed2\\\" -f textfullfield -k 0401f763 -o 4"); ProcessBuilder pb = new ProcessBuilder(commands); pb.start(); pb.redirectErrorStream(true); Process process = pb.start(); InputStream processOutput = process.getInputStream(); try { process.getOutputStream().close(); // fermeture du flux stdin inutilisé // lecture du flux par bloc de 512 bytes : byte[] b = new byte[512]; int len; while ( ( len = processOutput.read(b) ) > 0 ) { System.out.write(b, 0, len); } } finally { processOutput.close(); } } catch (IOException e) { } } }
Partager