Hi,
I want to execute unix commands(pdftops and ps2pdf) in windows system using java environment. but m getting error.plz help me.
here is my code:
public static Process p1;
public static Runtime rt;
rt = Runtime.getRuntime();
////linux commands
filename=args[0].replace(".pdf","temp.pdf");
String pdftopsCmd ="pdftops "+args[0]+" temp.ps";
String pstopdfCmd="ps2pdf temp.ps " +filename;
p1 = rt.exec(pdftopsCmd);//p1=process
Thread.sleep(10000);
p1=rt.exec(pstopdfCmd);
and the error is :
Exception in thread "main" java.io.IOException: CreateProcess: pdftops Test2.pdf temp.ps error=2
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)