I have a quick question: I am trying to call the following command line from a java application C:/phantomjs/phantomjs chart/chart.js
I tried doing:
public static void go3(){
Runtime rt=Runtime.getRuntime();
try{
final Process pr=rt.exec("cmd C:/phantomjs/phantomjs chart/chart.js");
final int exitCode=pr.waitFor();
if(exitCode!=0){ throw new RuntimeException("program didnt exit with 0, but with "+exitCode); }
// System.out.println(pr.toString());
// int exitStatus=pr.waitFor();
}catch(IOException e){
// TODO Auto-generated catch block
e.printStackTrace();
}catch(InterruptedException e){
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("done");
}
but I get exit code -1. I looked at various tutorials/question on stackoverflow but they all run trivial examples and I am struggling to understand how to write the part inside .exec("what goes here?")