0

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.