Bonjour,

J'ai un souci avec un processBuilder qui apparemment n'envoi pas correctement les arguments que je lui passe.

Lors de l'execution, mon appli tiers est bien lancée, mais les paramètres ne sont pas pris en compte

en ligne de commande cela s’exécute normalement, mes arguments sont pris en compte

je vous donne le code pour que ça vous éclaircisse plus mon problème

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
if(f.isFile()){
						args.add(itit.getProperty("NNT_pathExe"));
						args.add(" /patid " + rx.getNumeroRx());
						args.add(" /name " + rx.getPrenomPatRx());
						args.add(" /surname " + rx.getNomPatRx());
						args.add(" /dateb " + rx.getDatenaissancePatRx());
 
						for(String sfdf : args){
							System.out.print(sfdf);
						}
 
						executeCommandeRx cmdRx = new executeCommandeRx("", args,"C:/NNT");
						cmdRx.start();
je récupère même la ligne dans le output pour l’exécuter directement en ligne de commande et ça marche.
ce qui donne par exemple

C:/NNT/NNTBridge.exe /patid 879563 /name SERGE /surname POLO /dateb 26/08/1975

ma classe de processBuilder

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
 public class executeCommandeRx extends Thread{
 
	private List<String>  args;
	private String cmd;
	private String path ;
	private String workingDir;
	private Process p;
	private ProcessBuilder pb ;
	protected volatile boolean running = true;
 
	public executeCommandeRx(String cmd, List<String> args, String path) {
		this.args = args;
		this.cmd =cmd;
		this.path=path;
	}
 
	public void run() {
 
			try {
				List<String> strArgs = new ArrayList<String>();
				if (!cmd.isEmpty()) {
					strArgs.add(cmd);
				}
 
 
				strArgs.addAll(args);
				pb = new ProcessBuilder(strArgs);
				if(!path.isEmpty()){
 
				pb.directory(new java.io.File(path));
				}
				pb = pb.redirectErrorStream(true);
				p = pb.start();
 
				InputStream is = p.getInputStream();
				InputStreamReader isr = new InputStreamReader(is);
				BufferedReader br = new BufferedReader(isr);
				String line;
 
				while ((line = br.readLine()) != null) {
					System.out.println(line);
				}
 
			} catch (IOException e) {
 
			}
		}
 
 
	public void finishprocess(){
 
		System.out.println("Thread terminé");
		p.destroy();
		running=false;
	}
 
}
Si quelqu'un pouvait m'apporter une réponse ...