我的phantomjs.exe 在D盘/phantomjs/bin下,现在我要在java里面通过Runtime.getRuntime().exec()来运行这个命令:
phantomjs highcharts-convert.js -host 127.0.0.1 -port 3003
String cmd = "这里改如何写呢";
String cmd = "";
Runtime runtime = Runtime.getRuntime();
runtime.exec(cmd)
我的phantomjs.exe 在D盘/phantomjs/bin下,现在我要在java里面通过Runtime.getRuntime().exec()来运行这个命令:
phantomjs highcharts-convert.js -host 127.0.0.1 -port 3003
String cmd = "这里改如何写呢";
String cmd = "";
Runtime runtime = Runtime.getRuntime();
runtime.exec(cmd)
public static void main(String[] args) {
try
{
Process process = Runtime.getRuntime().exec ("ls");
InputStreamReader ir=new InputStreamReader(process.getInputStream());
LineNumberReader input = new LineNumberReader(ir);
String line;
while ((line = input.readLine ()) != null)
System.out.println(line);
}
catch (java.io.IOException e){
System.err.println ("IOException " + e.getMessage());
}
}
这是一个执行ls命令的例子,你在你自己机子上执行一下 你就明白了