Salut,
S'il vous plait je suis bloquée ,j'ai un problème pour l'utilisation d'une application décodeur que j'ai besoin l'intégrer dans une application java
le probléme que j'ai utilisée un processbuilder mais y'a des exceptions
je voudrais afficher dans l'application java comme ce qu'il m'affiche le décodeur avec une ligne de commande
j'ai essayé avec ce code en dessous mais ça marche pas
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 import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.ProcessBuilder.Redirect; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; /** * * @author ASUS */ public class rrcdecoder { String protocol; String msghexa; String line = ""; // public static void main(String[] args) throws IOException { final List<String> commands = new ArrayList<String>(); public rrcdecoder (String p,String m) {protocol=p; msghexa=m;} public String getcomment() throws IOException{ // msghexa="0401f763"; //protocol="RrcDl-DCCH"; String messageId = null; String sens; if (protocol=="RrcDl-DCCH" ) sens="4"; else sens="10"; commands.add("decoderplugincli.exe"); commands.add("--d"); commands.add("-s"); commands.add(msghexa); commands.add("-f"); commands.add("textfullfield"); commands.add("-k"); commands.add("0401f763"); commands.add("-o"); commands.add(sens); Runtime runtime = Runtime.getRuntime(); final Process process = runtime.exec(new String[] { "C:\\gatodecoder-1.3.3\\exe",commands.toString()}) ; // Consommation de la sortie standard de l'application externe dans un Thread separe new Thread() { public void run() { try { BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); try { while((line = reader.readLine()) != null) { // Traitement du flux de sortie de l'application si besoin est System.out.println(line); } } finally { reader.close(); } } catch(IOException ioe) { ioe.printStackTrace(); } } }.start();return line; }}pour la ligne de commande
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 java.io.IOException: Cannot run program "C:\gatodecoder-1.3.3\exe": CreateProcess error=5, Accès refusé at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at java.lang.Runtime.exec(Runtime.java:620) at java.lang.Runtime.exec(Runtime.java:485) at rrcdecoder.getcomment(rrcdecoder.java:47) at Scena.tracerflow(Scena.java:249) at Fenetre3$ListListener.doInBackground(Fenetre3.java:845) at Fenetre3$ListListener.doInBackground(Fenetre3.java:784) at javax.swing.SwingWorker$1.call(SwingWorker.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at javax.swing.SwingWorker.run(SwingWorker.java:334) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: CreateProcess error=5, Accès refusé at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(ProcessImpl.java:386) at java.lang.ProcessImpl.start(ProcessImpl.java:137) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ... 12 more
merci d'avance pour votre aide et vos réponses
Partager