jdk6 Everything you ever wanted to know and should know about Java Runtime.exec().すべてを知りたいと思っているとまでは知ってジャワruntime.exec ( ) 。

This old but still goldenこの古いですけどまだゴールデン article記事索引 is an excellent guide to using Runtime.exec().は、素晴らしいガイドを使用してruntime.exec ( ) 。 The key points he discusses are:彼は重要なポイントの説明:
1. 1 。 You need to drain the input stream to prevent because failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock.ドレインは、入力ストリームにする必要が失敗するのを防ぐため、速やかに書いて入力ストリームまたは出力ストリームは、サブプロセスを読むのが原因で、サブプロセスをブロックする、ともデッドロックです。

2. 2 。 Use waitFor() instead of exitValue() when you want to wait for the process to finish.使用waitfor ( )の代わりにexitvalue ( )したい場合には、処理が完了するまで待つことです。

3. 3 。 Runtime.exec() wouldn’t directly execute shell commands like dir / ls, copy / cp etc. You need to invoke the shell cmd.exe / bash / sh and pass the shell commands. runtime.exec ( )はないのようなシェルコマンドを直接実行するディレクトリ/ lsのは、コピー/ cp等のシェルを起動する必要がありますにcmd.exe / bashを/ shと通過するシェルコマンドです。 For example in windows your command array to execute dir would be as follows:たとえばWindowsのお客様のコマンドを実行するディレクトリの配列は以下のとおり:
cmd[0] = “cmd.exe” ; cmd [ 0 ] = " cmd.exeで" ;
cmd[1] = “/C” ; cmd [ 1 ] = " / c "と;
cmd[2] = “dir”; cmd [ 2 ] = "ディレクトリ" ;

Personally I have successfully used Runtime.exec() on several occasions.個人的に私は正常に使用されるruntime.exec ( )を数回です。 Any C programmer should quickly find equivalence with fork and system calls in C language.任意のCプログラマーズ等価性とフォークをすばやく見つける必要システムコールにはC言語です。 As always RTFM.いつもrtfmです。