shell.run("cmd /c java HelloWorldPrinter1 \""+output+"\"");
In the above line you are running java on the file HelloWorldPrinter1.
shell.run("cmd /c C:/printjobjava/HelloWorldPrinter1 \""+output+"\"");
But this line does not try to run java, but rather it tries to run C:/printjobjava/HelloWorldPrinter1 as an application itself, rather than running java.