I have following code
process = Runtime.getRuntime().exec("perl C:\Users\cigniti\Desktop\All text files\hello.pl");
at this line I am getting error "Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )"
So how do I provide path for perl script ? How can I run this script here ?
[Edit: I got tired of looking at "Wxecuting" so I fixed the title]
@nirjari: Or indeed, find another way of doing this. I'm sure others will jump all over me here, but what you're doing just doesn't sound right.
Either this a Java program whose sole purpose is to process the output of this perl script, or it's part of a larger system of which this is only a tiny part.
If it's the first, why not simply pipe the output of your perl script to your Java program?
If it's the latter, it might be worth considering whether you should either:
(a) Re-write this perl script in Java.
(b) Put the output of this script in a known file.
Maybe I'm just behind the times; but I get very leery about things like Runtime.exec()'s and ProcessBuilder's.
Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here