[JAVA] Lancer un script shell depuis Java

Bonjour,

Comment faire pour lancer un script shell (harris.sh) depuis un programme Java ?

Merci de votre aide
Configuration: Java SDK1.4.2

Linux

2 réponses

  1. Bonsoir,

    Et comme ceci:

    try {
    Process proc = Runtime.getRuntime().exec("harris.sh");
    }
    catch(IOException e) {

    }

    ? çà marche?
    1. svp c urgent
      je veu savoir comment lancer un script shell avec des parametres?
      et merci
    2. non ta méthode ne fonctionne pas,malheuresement .
  2. Contributeur
    system("blabla.sh");
    ? ca marche pas ca ?
    1. Non ca marche pas, il me renvoie l'erreur suivante :

      ActionOK.java:18: cannot resolve symbol
      symbol : method System (java.lang.String)
      location: class ActionOK
      System("harris.sh");
      ^
      1 error