bonjour,
voilà tout est dans le titre, je voudrai faire appel à une commande unix dans mon code java, j'ai trouvé ce lien http://blog.developpez.com/adiguba/p...s-plus-simple/


j'ai attaché le .jar à mon projet et j'ai teste ce code là:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
Shell sh = new Shell(); 
String result = sh.exec("ls | sort").consumeAsString();
mais ça marche pas, ce qu'il m'affiche comme erreur




java.io.IOException: java.io.IOException: Aucun fichier ou répertoire de ce type
at java.lang.PosixProcess.<init>(libgcj.so.8rh)
at java.lang.VMProcess.nativeExec(libgcj.so.8rh)
at java.lang.VMProcess.exec(libgcj.so.8rh)
at java.lang.ProcessBuilder.start(libgcj.so.8rh)
at com.developpez.adiguba.shell.ProcessConsumer.getProcess(ProcessConsumer.java:471)
at com.developpez.adiguba.shell.ProcessConsumer.consume(ProcessConsumer.java:486)
at com.developpez.adiguba.shell.ProcessConsumer.consumeAsString(ProcessConsumer.java:541)
at p.Premier.main(Premier.java:35)
Caused by: java.io.IOException: Aucun fichier ou répertoire de ce type
at java.lang.PosixProcess.nativeSpawn(libgcj.so.8rh)
at java.lang.PosixProcess.spawn(libgcj.so.8rh)
at java.lang.PosixProcess$ProcessManager.run(libgcj.so.8rh)



merci