je travaille sur une application java qui exécute un fichier .bat à distance grâce à la commande PsExec.
Mon problème est le suivant :
le processus Psexec se lance sur la machine distante mais se termine avec un code erreur 1 ( arret par l'utlisateur )sans aucune manipulation de ma part.
Ca plante dans la boucle while quand il récupère les lignes dans sderr.

Voici mon code
*******************************************

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
public void ExecBat(){
 
        String expr="";
        String cmd= ("C:\\PsTools\\psexec.exe "+srv+" " );
        String param= "192.168.0.0 "+adrIP+" "+adrMAC+" "+nom+" "+desc+" ";
 
 
        if (user.isEmpty()){
        expr = cmd+" "+path+" "+param+"";
        }else{
        expr = cmd+"-u "+user+" -p "+pwd+" "+path+" "+param+"";
        }
 
        try {
        Runtime r =Runtime.getRuntime();
        Process p = r.exec(expr);
 
            InputStream is =p.getInputStream();
            InputStream err = p.getErrorStream();
            String line;
            /*BufferedReader out= new BufferedReader(new InputStreamReader (is));*/
            BufferedReader errder= new BufferedReader(new InputStreamReader (err));
            while ((line = errder.readLine())!= null){
                System.out.println(line);
                    }
 
        p.waitFor();
        errorlevel = p.exitValue();
        p.getErrorStream().close();
        p.getInputStream().close();
        p.destroy();
        }
        catch (IOException e) {
        JOptionPane.showMessageDialog(BootLRSView, e);
        }
        catch (InterruptedException f){
        JOptionPane.showMessageDialog(BootLRSView, f);
        }
    }
*******************
sortie de PsExec
*******************
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
PsExec v1.94 - Execute processes remotely
Copyright (C) 2001-2008 Mark Russinovich
Sysinternals - www.sysinternals.com
 
Connecting to srv-mpp-ad3...
 
 
Starting PsExec service on srv-mpp-ad3...
 
 
Connecting with PsExec service on srv-mpp-ad3...
 
 
Starting C:\test1.bat on srv-mpp-ad3...
 
 
 
C:\test1.bat exited on srv-mpp-ad3 with error code 1.
**************************************************

Merci d'avance à la personne qui arrivera à débloquer la situation
J'exécute l'application sous XP et le serveur est sous Windows Server 2003