Invoke Powershell scripts from Java

前端 未结 3 1094
盖世英雄少女心
盖世英雄少女心 2020-12-08 11:56

I want to invoke my powershell script from java. Can it be done. I tried with the following code, but the stream is not closing.

import java.io.BufferedRead         


        
3条回答
  •  一生所求
    2020-12-08 12:35

    After starting the process ( runtime.exec() ), add a line to close the input stream of the process ( which JAVA calls output stream!!):

     proc.getOutputStream().close();
    

提交回复
热议问题