IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

API standards et tierces Java Discussion :

[Système][Runtime]lancer une application externe


Sujet :

API standards et tierces Java

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2005
    Messages : 85
    Points : 55
    Points
    55
    Par défaut [Système][Runtime]lancer une application externe
    Bonjour,

    J'ai un pb que je ne comprends pas avec ce 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
        public void run() {
     
            System.out.println("Simmetrix starts running");
            String [] Cmd={"/disk3/home/mencaglia/develop/cfd-mp/meshParasol/meshParasol-current","-s", "/disk3/home/mencaglia/jbproject/Solver/cas2.msf" };
            for (int i=0; i<3; i++)
                System.out.println(Cmd[i]);
     
            try {
                Runtime r = Runtime.getRuntime();
                r.traceInstructions(true);
                Process proc = r.exec(Cmd);
                int test = proc.exitValue();
                int status = proc.waitFor();
     
     
                System.out.println(test);
                System.out.println(status);
            }
            catch (IOException e) {
                System.out.println("erreur d'execution " + Cmd + e.toString());
            }
            catch (InterruptedException e) {
                System.out.println("interruption " + Cmd + e.toString());
            }
            catch (IllegalThreadStateException e)
            {
                System.out.println("interruption 2" + Cmd + e.toString());
                e.printStackTrace();
            }
            System.out.println("End of run");
        }
    et je reçois ce message aprés éxécution:

    interruption2 [Ljava.lang.String;@17590dbjava.lang.IllegalThreadStateException: process hasn't exited

    meshParasol-current est un mailleur, je tape dans le shell habituellement pour mailler une pièce meshParasol -s cas2.msf car j'ai déf un alias.
    La je mets le chemin complet et apparemment il trouve cette exe mais je comprends pas pourquoi le process ne se termine pas!

    Merci,
    Xavier

    Si qqn peut m'aider

  2. #2
    Membre chevronné
    Homme Profil pro
    Dév. Java & C#
    Inscrit en
    Octobre 2002
    Messages
    1 414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Dév. Java & C#
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2002
    Messages : 1 414
    Points : 1 996
    Points
    1 996
    Par défaut
    Cher mencaglia,

    Je viens justement de pondre une tartine sur ce sujet ce matin.

    Voici le lien [FLUX] recuperer entree et sortie d'un programme externe
    Bien le bonjour chez vous
    Jowo

  3. #3
    Membre chevronné
    Homme Profil pro
    Dév. Java & C#
    Inscrit en
    Octobre 2002
    Messages
    1 414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Dév. Java & C#
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2002
    Messages : 1 414
    Points : 1 996
    Points
    1 996
    Par défaut
    L'erreur vient de
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    int test = proc.exitValue();
    .

    Tu ne peux connaître le status retourné avant que le programme soit terminé. Tout est expliqué dans la Javadoc.

    Prend l'habitude d'avoir à tes côtés la Javadoc de la classe que tu utilises.
    Bien le bonjour chez vous
    Jowo

  4. #4
    Membre du Club
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2005
    Messages : 85
    Points : 55
    Points
    55
    Par défaut
    Si je comprends bien c'est le waitFor qui est bloquant donc je dois faire :
    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
     Thread waitFor = new Thread() {
            public void run() {
                try {
                    proc.waitFor();
                }
                catch(InterruptedException ie) {
                    ie.printStackTrace();
                }
            }
        };
        waitFor.start();
     
        /* On attend jusqu'à 60 secondes que le subProcess se termine */
        int status = -1;
        try {
            waitFor.join(60000);
            status = process.exitValue();
        }
        catch (InterruptedException ie) {
            ie.printStackTrace();
        }
     
     
        input.close();
        inpFile.close();

    Xavier

  5. #5
    Membre du Club
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2005
    Messages : 85
    Points : 55
    Points
    55
    Par défaut
    mais si j'enlève exitValue, j'ai pas de message mais ca ne fais rien!


    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
    public void run() {
     
            System.out.println("Simmetrix starts running");
            String [] Cmd={"/disk3/home/mencaglia/develop/cfd-mp/meshParasol/meshParasol-current","-s", "/disk3/home/mencaglia/jbproject/Solver/cas2.msf" };
            for (int i=0; i<3; i++)
                System.out.println(Cmd[i]);
     
            try {
                Runtime r = Runtime.getRuntime();
                r.traceInstructions(true);
                r.traceInstructions(true);
                r.traceMethodCalls(true);
                Process proc = r.exec(Cmd);
     
                //int test = proc.exitValue();
               // int status = proc.waitFor();
                proc.getInputStream().close();
                proc.getOutputStream().close();
                proc.getErrorStream().close(); 
     
     
     
                //System.out.println(test);
               // System.out.println(status);
            }
            catch (IOException e) {
                System.out.println("erreur d'execution " + Cmd + e.toString());
            }
            catch (InterruptedException e) {
                System.out.println("interruption " + Cmd + e.toString());
            }
            catch (IllegalThreadStateException e)
            {
                System.out.println("interruption 2" + Cmd + e.toString());
                e.printStackTrace();
            }
            System.out.println("End of run");
        }

    je comprends pas,

    Xavier

  6. #6
    Membre chevronné
    Homme Profil pro
    Dév. Java & C#
    Inscrit en
    Octobre 2002
    Messages
    1 414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Dév. Java & C#
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2002
    Messages : 1 414
    Points : 1 996
    Points
    1 996
    Par défaut
    Que ne comprends-tu pas?
    Bien le bonjour chez vous
    Jowo

  7. #7
    Membre du Club
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2005
    Messages : 85
    Points : 55
    Points
    55
    Par défaut
    ben l'application que je veux lancer ne se lance 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
     public void run() {
     
            System.out.println("Simmetrix starts running");
            String [] Cmd={"/disk3/home/mencaglia/develop/cfd-mp/meshParasol/meshParasol-current","-s", "/disk3/home/mencaglia/jbproject/Solver/cas2.msf" };
            for (int i=0; i<3; i++)
                System.out.println(Cmd[i]);
     
            try {
                Runtime r = Runtime.getRuntime();
                r.traceInstructions(true);
                r.traceInstructions(true);
                r.traceMethodCalls(true);
                Process proc = r.exec(Cmd);
                proc.getInputStream().close();
                proc.getOutputStream().close();
                proc.getErrorStream().close(); 
     
                //int test = proc.exitValue();
                int status = proc.waitFor();
     
     
     
                //System.out.println(test);
                [b]System.out.println(status);[/b]
            }
            catch (IOException e) {
                System.out.println("erreur d'execution " + Cmd + e.toString());
            }
            catch (InterruptedException e) {
                System.out.println("interruption " + Cmd + e.toString());
            }
            catch (IllegalThreadStateException e)
            {
                System.out.println("interruption 2" + Cmd + e.toString());
                e.printStackTrace();
            }
            System.out.println("End of run");
        }

    le status que j'affiche est 129??? je devrais avoir 0 si ca se lancait bien.

    Xavier

  8. #8
    Membre chevronné
    Homme Profil pro
    Dév. Java & C#
    Inscrit en
    Octobre 2002
    Messages
    1 414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Dév. Java & C#
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2002
    Messages : 1 414
    Points : 1 996
    Points
    1 996
    Par défaut
    Unix Error: error 129.. standard output/error size isdifferent

    Je suppose que le problème provient que tu ferme la sortie standart du processus "meshParasol-current".

    Doit-il sortir des informations sur la sortie standard?

    Si oui, alors il est nécessaire que tu lises le tampon de sortie standard. Je te conseille de faire de même pour la sortie des erreurs. (voir l'exemple que je t'ai envoyé).
    Bien le bonjour chez vous
    Jowo

  9. #9
    Membre du Club
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2005
    Messages : 85
    Points : 55
    Points
    55
    Par défaut
    plusieurs questions, j'ai fais ce que tu m'as dit:

    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
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
       public void run() {
     
            System.out.println("Simmetrix starts running");
            String [] [b]Cmd={"/disk3/home/mencaglia/develop/cfd-mp/meshParasol/meshParasol-current","-s", "/disk3/home/mencaglia/jbproject/Solver/cas2.msf" };[/b]
            for (int i=0; i<3; i++)
                System.out.println(Cmd[i]);
     
            try {
                Runtime r = Runtime.getRuntime();
                r.traceInstructions(true);
                r.traceInstructions(true);
                r.traceMethodCalls(true);
                final Process proc = r.exec(Cmd);
                new Thread() {
                    public void run() {
                        try {
                            BufferedInputStream errStream =
                            new BufferedInputStream(proc.getErrorStream());
                            byte[] buffer = new byte[128];
                            int read;
     
                            while ((read = errStream.read(buffer, 0, buffer.length)) != -1) {
                                System.err.write(buffer, 0, read);
                            }
                            errStream.close();
                        }
                        catch (IOException ioe) {
                            ioe.printStackTrace();
                        }
                    }
                }.start(); 
                new Thread() {
                    public void run() {
                        try {
                            BufferedInputStream outStream =
                            new BufferedInputStream(proc.getInputStream());
                            byte[] buffer = new byte[128];
                            int read;
     
                            while ((read = outStream.read(buffer, 0, buffer.length)) != -1) {
                                System.out.write(buffer, 0, read);
                            }
                            outStream.close();
                        }
                        catch (IOException ioe) {
                            ioe.printStackTrace();
                        }
                    }
                }.start(); 
     
                FileInputStream inpFile = new FileInputStream(new File("/disk3/home/mencaglia/jbproject/Solver/data.txt"));
                final BufferedInputStream input = new BufferedInputStream(inpFile);
                new Thread() {
                    public void run() {
                        try {
                            BufferedOutputStream inpStream =
                            new BufferedOutputStream(proc.getOutputStream());
                            byte[] buffer = new byte[256];
                            int read;
     
                            while ((read = input.read(buffer, 0, buffer.length)) != -1) {
                                inpStream.write(buffer, 0, read);
                            }
                        } catch (IOException ioe) {
                            ioe.printStackTrace();
                        }
                    }
                }.start(); 
     
                input.close();
                inpFile.close();
     
                proc.getInputStream().close();
                proc.getOutputStream().close();
                proc.getErrorStream().close(); 
                int status = proc.waitFor();
                //int test = proc.exitValue();
     
     
     
     
                //System.out.println(test);
                System.out.println(status);
            }
            catch (IOException e) {
                System.out.println("erreur d'execution " + Cmd + e.toString());
            }
            catch (InterruptedException e) {
                System.out.println("interruption " + Cmd + e.toString());
            }
            catch (IllegalThreadStateException e)
            {
                System.out.println("interruption 2" + Cmd + e.toString());
                e.printStackTrace();
            }
            System.out.println("End of run");
        }

    1/mais malheureusement je n'attends pas que la commande meshParasol -s cas2.msf soit terminée et le reste du programme déroule quand même, comment faire???
    2/
    Sinon je voulais savoir a quoi correspond le data .txt??[/u]

  10. #10
    Membre chevronné
    Homme Profil pro
    Dév. Java & C#
    Inscrit en
    Octobre 2002
    Messages
    1 414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Dév. Java & C#
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2002
    Messages : 1 414
    Points : 1 996
    Points
    1 996
    Par défaut
    data.txt contient les données de ton subProcess si ton subProcess doit lire des données depuis son entrée standard.

    Essaie ce 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
    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
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
     
      public void run() { 
     
            System.out.println("Simmetrix starts running"); 
            String [] [b]Cmd={"/disk3/home/mencaglia/develop/cfd-mp/meshParasol/meshParasol-current","-s", "/disk3/home/mencaglia/jbproject/Solver/cas2.msf" };[/b] 
            for (int i=0; i<3; i++) 
                System.out.println(Cmd[i]); 
     
            try { 
                Runtime r = Runtime.getRuntime();
    /*
    Je pense que les 3 lignes suivantes sont inutiles dans notre cas
    */
                r.traceInstructions(true); 
                r.traceInstructions(true); 
                r.traceMethodCalls(true); 
     
                final Process proc = r.exec(Cmd); 
                new Thread() { 
                    public void run() { 
                        try { 
                            BufferedInputStream errStream = 
                            new BufferedInputStream(proc.getErrorStream()); 
                            byte[] buffer = new byte[128]; 
                            int read; 
     
                            while ((read = errStream.read(buffer, 0, buffer.length)) != -1) { 
                                System.err.write(buffer, 0, read); 
                            } 
                            errStream.close(); 
                        } 
                        catch (IOException ioe) { 
                            ioe.printStackTrace(); 
                        } 
                    } 
                }.start(); 
                new Thread() { 
                    public void run() { 
                        try { 
                            BufferedInputStream outStream = 
                            new BufferedInputStream(proc.getInputStream()); 
                            byte[] buffer = new byte[128]; 
                            int read; 
     
                            while ((read = outStream.read(buffer, 0, buffer.length)) != -1) { 
                                System.out.write(buffer, 0, read); 
                            } 
                            outStream.close(); 
                        } 
                        catch (IOException ioe) { 
                            ioe.printStackTrace(); 
                        } 
                    } 
                }.start(); 
     
    /*
      Seulement utile si ton programme lit depuis son entrée standard
     
                FileInputStream inpFile = new FileInputStream(new File("/disk3/home/mencaglia/jbproject/Solver/data.txt")); 
                final BufferedInputStream input = new BufferedInputStream(inpFile); 
                new Thread() { 
                    public void run() { 
                        try { 
                            BufferedOutputStream inpStream = 
                            new BufferedOutputStream(proc.getOutputStream()); 
                            byte[] buffer = new byte[256]; 
                            int read; 
     
                            while ((read = input.read(buffer, 0, buffer.length)) != -1) { 
                                inpStream.write(buffer, 0, read); 
                            } 
                        } catch (IOException ioe) { 
                            ioe.printStackTrace(); 
                        } 
                    } 
                }.start(); 
     
                input.close(); 
                inpFile.close(); 
    */
     
    /*
        La fermeture des 3 trois streams me semblent  inutiles.
    */
                proc.getInputStream().close(); 
                proc.getOutputStream().close(); 
                proc.getErrorStream().close(); 
                int status = proc.waitFor(); 
                //int test = proc.exitValue(); 
     
     
     
     
                //System.out.println(test); 
                System.out.println(status); 
            } 
            catch (IOException e) { 
                System.out.println("erreur d'execution " + Cmd + e.toString()); 
            } 
            catch (InterruptedException e) { 
                System.out.println("interruption " + Cmd + e.toString()); 
            } 
            catch (IllegalThreadStateException e) 
            { 
                System.out.println("interruption 2" + Cmd + e.toString()); 
                e.printStackTrace(); 
            } 
            System.out.println("End of run"); 
        }
    Citation Envoyé par mencaglia
    /mais malheureusement je n'attends pas que la commande meshParasol -s cas2.msf soit terminée et le reste du programme déroule quand même, comment faire???
    Je ne comprends pas cette remarque.
    Bien le bonjour chez vous
    Jowo

  11. #11
    Membre du Club
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2005
    Messages : 85
    Points : 55
    Points
    55
    Par défaut
    ben je lance un process qui est en fait un programme et en fait j'ai mon End Of Run qui s'affiche sur la console et ensuite je voie mon application qui m'affiche ses sorties donc en fait le waitFor n'attends pas que le programme soit terminé pour rendre la main et éxécuter la suite du code.

    Xavier

  12. #12
    Membre du Club
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2005
    Messages : 85
    Points : 55
    Points
    55
    Par défaut
    erreur d'execution [Ljava.lang.String;@47858ejava.io.FileNotFoundException: data.txt (No such file or directory)

    au fait au sujet du data.txt j'ai un problème d'exeption... pourtant data.txt est un fichier qui est créer par mon Thread.

    Xavier

  13. #13
    Membre du Club
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2005
    Messages : 85
    Points : 55
    Points
    55
    Par défaut
    Merci à tous le monde mais j'ai résolu mon pb

    Bonne aprem
    Xavier

  14. #14
    Membre chevronné
    Homme Profil pro
    Dév. Java & C#
    Inscrit en
    Octobre 2002
    Messages
    1 414
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Dév. Java & C#
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2002
    Messages : 1 414
    Points : 1 996
    Points
    1 996
    Par défaut
    Peut-on connaître comment tu as résolu ton problème?
    Bien le bonjour chez vous
    Jowo

  15. #15
    Membre du Club
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    85
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2005
    Messages : 85
    Points : 55
    Points
    55
    Par défaut
    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
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
       public void run() {
     
            System.out.println("Simmetrix starts running");
            String [] Cmd={"/disk3/home/mencaglia/develop/cfd-mp/meshParasol/meshParasol-current","-s", "/disk3/home/mencaglia/jbproject/Solver/cas2.msf" };
     
            try {
                Runtime r = Runtime.getRuntime();
                r.traceInstructions(true);
                r.traceInstructions(true);
                r.traceMethodCalls(true);
                final Process proc = r.exec(Cmd);
     
                new Thread() {
                    public void run() {
                        try {
                            BufferedInputStream errStream =
                            new BufferedInputStream(proc.getErrorStream());
                            byte[] buffer = new byte[128];
                            int read;
     
                            while ((read = errStream.read(buffer, 0, buffer.length)) != -1) {
                                System.err.write(buffer, 0, read);
                            }
                            errStream.close();
                        }
                        catch (IOException ioe) {
                            ioe.printStackTrace();
                        }
                    }
                }.start(); 
     
                new Thread() {
                    public void run() {
                        try {
                            BufferedInputStream outStream =
                            new BufferedInputStream(proc.getInputStream());
                            byte[] buffer = new byte[128];
                            int read;
     
                            while ((read = outStream.read(buffer, 0, buffer.length)) != -1) {
                                System.out.write(buffer, 0, read);
                            }
                            outStream.close();
                        }
                        catch (IOException ioe) {
                            ioe.printStackTrace();
                        }
                    }
                }.start(); 
     
     
                Thread waitFor = new Thread() {
                    public void run() {
                        try {
                            proc.waitFor();
                        }
                        catch(InterruptedException ie) {
                            ie.printStackTrace();
                        }
                    }
                };
                waitFor.start();
     
                int status = -1;
                try {
                    waitFor.join();
                    status = proc.exitValue();
                }
                catch (InterruptedException ie) {
                    ie.printStackTrace();
                } 
     
                System.out.println(status);
            }
            catch (IOException e) {
                System.out.println("erreur d'execution " + Cmd + e.toString());
            }
            catch (IllegalThreadStateException e)
            {
                System.out.println("interruption 2" + Cmd + e.toString());
                e.printStackTrace();
            }
            System.out.println("End of run");
        }
    }

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [VB.NET] Comment lancer une application externe dans ma Form
    Par afdmats dans le forum Windows Forms
    Réponses: 1
    Dernier message: 03/10/2006, 15h27
  2. [API] Lancer une application externe via un code Java
    Par k o D dans le forum Général Java
    Réponses: 19
    Dernier message: 09/03/2006, 15h12
  3. [Runtime]lancer une application externe
    Par biozaxx dans le forum Général Java
    Réponses: 3
    Dernier message: 09/11/2005, 17h13
  4. [Système][Runtime] lancer une commade avec un PIP
    Par IVAGO dans le forum API standards et tierces
    Réponses: 18
    Dernier message: 19/08/2005, 19h49

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo