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.
java を使用して powershell コマンドレットを実行したい。これを実装する方法はありますか?Runtime コマンドと exec コマンドを使用してみましたが、その間に出力ウィンドウがハングします。
新しい ProcessBuilder クラスを使用する方が簡単です。Runtime.exec には、正しく動作させるために覚えておく必要がある落とし穴がいくつかあります。たとえば、プロセスへの入力ストリームと出力ストリームが正しく処理されるようにする必要があります。
ProcessBuilder の使用例については、Google で検索することをお勧めします。