[JAVA] Lancer un script shell depuis Java

jerome -  
 jernux -
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. philtrain
     
    Bonsoir,

    Et comme ceci:

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

    }

    ? çà marche?
    0
    1. bilelm Messages postés 3 Statut Membre
       
      svp c urgent
      je veu savoir comment lancer un script shell avec des parametres?
      et merci
      0
    2. jernux
       
      non ta méthode ne fonctionne pas,malheuresement .
      0
  2. kij_82 Messages postés 4102 Date d'inscription   Statut Contributeur Dernière intervention   857
     
    system("blabla.sh");
    ? ca marche pas ca ?
    -1
    1. jerome
       
      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
      0