기본적으로이 명령을 손으로 에 입력하면 sift 프로그램이 작동하고 .key 파일을 작성하지만 내 프로그램에서 호출하려고하면 아무 것도 쓰지 않습니다.java getRuntime(). exec()가 작동하지 않습니까?
나는 exec() 메소드를 올바르게 사용하고 있습니까? API를 살펴본 결과 내가 잘못 된 부분을 발견 할 수없는 것 같습니다. 그들은 해석 쉘에 의해 실행될 때
public static void main(String[] args) throws IOException, InterruptedException
{
//Task 1: create .key file for the input file
String[] arr = new String[3];
arr[0] = "\"C:/Users/Wesley/Documents/cv/final project/ObjectRecognition/sift/siftWin32.exe\"";
arr[1] = "<\"C:/Users/Wesley/Documents/cv/final project/ObjectRecognition/sift/cover_actual.pgm\"";
arr[2] = ">\"C:/Users/Wesley/Documents/cv/final project/ObjectRecognition/sift/keys/cover_actual.key\"";
String command = (arr[0]+" "+arr[1]+" "+arr[2]);
Process p=Runtime.getRuntime().exec(command);
p.waitFor();
BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
String line=reader.readLine();
while(line!=null)
{
System.out.println(line);
line=reader.readLine();
}
}
가 어떤 오류를 ?? –
나는 어떤 에러도 내지 않지만, .key 파일을 다음과 같이 쓰지 않는다. –
'Runtime.exec'에서 출력 리다이렉션을 사용할 수 있습니까? – zneak