import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.stream.Stream;
public class project {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
String command = "powershell.exe Get-Entity -Collection openrpa -Type workflow";
// Executing the command
Process powerShellProcess = Runtime.getRuntime().exec(command);
// Getting the results
powerShellProcess.getOutputStream().close();
String line;
System.out.println("Standard Output:");
BufferedReader stdout = new BufferedReader(new InputStreamReader(powerShellProcess.getInputStream()));
while ((line = stdout.readLine()) != null) {
System.out.println(line);
}
stdout.close();
System.out.println("Standard Error:");
BufferedReader stderr = new BufferedReader(new InputStreamReader(powerShellProcess.getErrorStream()));
while ((line = stderr.readLine()) != null) {
System.out.println(line);
}
stderr.close();
System.out.println("Done");
}
}
참고 : stackoverflow.com/questions/29545611/executing-powershell-commands-in-java-program/29545926#29545926
문제 발생 : console창에서 한글 깨짐
1. eclipse 한글 깨짐 검색 (참고)
Window > Preferences 확인했더니 이미 UTF-8 설정 상태
2. eclipse console 한글 깨짐 검색 (참고)
Run > Run Configurations... > common > encoding 확인했더니 이것도 UTF-8 설정 되어 있음...
3. 해결 방법 찾지 못함. 그냥 workflow명을 영어로 수정하는 수밖에...
'문제 발생 및 해결' 카테고리의 다른 글
OZ 리포트 패러미터 여러개 (0) | 2021.05.07 |
---|---|
폴더 생성하여 jsp 파일 이동했을 때 뜨는 에러 (0) | 2021.04.29 |
PowerShell에서 Node-RED 실행할 때 에러 발생 (0) | 2021.04.06 |
원격 서버 에러났을 때 (0) | 2020.12.24 |
java.io.FileNotFoundException (지정된 경로를 찾을 수 없습니다) (0) | 2020.12.14 |