Help: Executing perl script from java
Hi,
Im trying to execute a perl script with parameters from my java code. given below is the first few lines.
Code :
try
{
p = Runtime.getRuntime().exec("perl E:\\tools\\Rouge1551\\ROUGE-1.5.5.pl -n 4 -w 1.2 -m -2 4 -u -c 95 -r 1000 -f A -p 0.5 -t 0 -a E:/tools/Rouge1551/rougejk_A1.in");
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line="";
while ((line = input.readLine()) != null) {
System.out.println(line);
}
p.waitFor();
}
catch(Exception e)
{
System.out.println("Exception: "+ e.toString());
}
finally {
if (p != null) {
close(p.getInputStream());
close(p.getErrorStream());
close(p.getOutputStream());
p.destroy();}
}
The program does not print anything, since p.getInputStream returns null. The command works when i run in command prompt.
please help.
thanks
jessie
Re: Help: Executing perl script from java
Try using a String array vs a String in the exec() method.
Also read and print the error stream to see if there are any error messages.
Re: Help: Executing perl script from java
thanks a lot. it was not working because there were some warnings. i corrected it and it works.!
great.!