Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
別のjarファイルを起動するJavaでプログラムを作成しています。System.out.println() を使用するときに jar が出力するすべてのもの、またはそれが出力するエラーをどのように読み取ることができますか?
おそらく、または「他のjarを開始する」ためにどちらProcessBuilder.start()かを使用していますが、どちらもオブジェクトを返します。このインスタンスを呼び出すと、 stdout を表す が得られます。を呼び出すと、stderr が返されます。Runtime.exec()ProcessgetInputStream()InputStreamgetErrorStream()
ProcessBuilder.start()
Runtime.exec()
Process
getInputStream()
InputStream
getErrorStream()