comment executer un script sh en java
salut,
quelqu'un sait comment exécuter un script shell sh dans un programme java, je suis entraine de faire un programme test mais cela ne marche pas pour l'instant, est ce que quelqu'un peut m'aider?
voila mon programme test
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| import java.io.IOException;
public class test {
public test(){
}
public void lancerDEmoShell(String nomShell) throws IOException {
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("sh"+""+nomShell);
}
public static void main(String[] args) throws IOException {
test t = new test();
t.lancerDEmoShell("/cygdrive/c/dossier/monscript.sh");
}
} |
merci pour votre aider