Reputation: 141
I am trying to convert an HTML file to pdf and view it using my pdf viewer(vsmartpdf.exe).Its a cmd command which goes like "vmartpdf.exe -c 'path of html file' 'path of output folder' ". I am trying to execute this command using java program . Below is what i did.
import java.io.IOException;
public class LoadTesting implements Runnable {
@Override
public void run() {
try {
//String command = "C:\\Users\\vishalt\\Desktop\\New Source\\deliver\\vsmartpdf\\vsmartpdf.exe";
//Runtime.getRuntime().exec("cmd /c "+command);
//Process process = new ProcessBuilder("cmd.exe", "/c", "cd \"C:\\Users\\vishalt\\Vsmartfinal\" && dir").start();
Runtime rt = Runtime.getRuntime();
String[] cmd = { "C:\\Users\\Desktop\\Vsmartfinal\\vsmartpdf.exe", "-c", "C:\\Users\\vishalt\\Desktop\\output\\SCB_MOLPU.HTML", " C:\\Users\\vishalt\\Desktop\\output\\"};
Process p = rt.exec(cmd);
System.out.println("Called");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
then i am calling this thread . But i am getting error as CreateProcess error=2, The system cannot find the file specified. Can somebody please help me with it
Upvotes: 0
Views: 1086
Reputation: 328556
The error message means that C:\Users\Desktop\Vsmartfinal\vsmartpdf.exe
doesn't exist at the time when the code is executed.
A common source for this problem is that this executable exists in a developer machine but not on the production server.
Upvotes: 1