Search code examples
javapathactivexobject

Path change ActiveXObject not working


I am using ActiveXObject for some print jobs what I doing is placing java class file on Desktop and doing stuff as follows:

var shell = new ActiveXObject("WScript.Shell");
shell.run("cmd /c java HelloWorldPrinter1 \""+output+"\"");

It works fine.

I have moved my class file into C:\printjob

So I tried as follows:

 var shell = new ActiveXObject("WScript.Shell");
  shell.run("cmd /c C:/printjobjava/HelloWorldPrinter1 \""+output+"\"");

It is not working.

How can put path of a file correctly in ActiveXObject? Have gone through various links but no use


Solution

  • I got the answer finally

    shell.run("cmd /c java -cp C:\\printjob HelloWorldPrinter1 \""+output+"\"");