2011年7月11日月曜日

Javaの外部コマンドを実行

Runtime.getRuntime().exec();を使う時には、
色々な制限がある。

String[] cmd = {"java","-version"};
Runtime.getRuntime().exec(cmd);

守らないと、下記エラーに捕まる。
java.io.IOException: java.io.IOException: java: not found

参考URL
http://www.smg.co.jp/JavaTroubleshooting/trouble011Phenomenon.html#trouble5
http://www.whitemark.co.jp/tec/java/javaExamples9.html

0 件のコメント: