Bonjour,
Je voudrais appeler un script Perl depuis ma classe java. Ce script a 2 arguments . Voila ce que je fais mais j'ai une jolie "Command failure". J'ai essaye plusieurs combinaisons du tableau command en vain.
J'ai essaye avec un autre script tout simple qui affiche "bonjour" et ca marche, mais la pas moyen de l'executer...
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 public static void main(String args[]) { try { String[] command = {"C:\\Perl\\bin\\perl.exe","C:\\dev\\Perl\\test.pl",args[0],args[1]}; Process p = Runtime.getRuntime().exec(command); p.waitFor(); if (p.exitValue() == 0) { System.out.println("CommandSuccessful"); } else { System.out.println("CommandFailure"); } } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } }
Si vous pouviez m'aider.
Merci.
Partager