imagemagick 명령을 사용하여 이미지를 편집하는 Java 애플리케이션을 작성하고 있습니다. 그러나 comands는 작동하지 않으며 출력이 없습니다. 사실, 신분증은 인식되지 않고 CreateProcess error=2
이됩니다. imagemagick 설치 폴더가 내 Path 변수에 포함되어있어 이상하게 보입니다. 당신은 실행 파일의 경로에 공백이java로 imagemagick 명령을 실행해도 출력이 없습니다
public class Test {
public static void main(String argv[]) {
Runtime ru = Runtime.getRuntime();
Process p = null;
try {
//I've added this as a bouns, this should not be neccessary(methinks)
String[] s = {"C:\\Program Files\\ImageMagick-6.8.6-Q16"};
String[] cmd = {"convert", "acc-logo.jpg","-flip", "edited.jpg"};
p = ru.exec(cmd,s);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
BufferedReader ina = new BufferedReader(new InputStreamReader(
p.getInputStream()));
String line = null;
try {
while ((line = ina.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
ProcessBuilder 사용을 고려하십시오. – Jayan