자바 :자바 runtine.exec은 : 경로 변경되지 않습니다
public static void startCmd(String path)
{
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(path);
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream(), "cp852"));
String line = null;
// redirection output to console
while((line = input.readLine()) != null) {
System.out.println(line);
}
System.out.println("Error code: " + pr.waitFor());
}
public static void main(String[] args) {
startCmd("c:\\run.bat");
}
run.bat를 :
D:\WORKSPACE\TEST>cd c:\cmd\
D:\WORKSPACE\TEST>application.exe // path should be changed from D:\WORKSPACE\TEST> to c:\cmd>
Error code: 0
: 콘솔에서
cd c:\cmd\
application.exe
출력 왜 cd c:\cmd\
명령이 Java 콘솔 응용 프로그램에 전달되지 않습니다 ???
니스, 정말 고마워요 !! – gaffcz