나는 내가이 코드를 실행 한 후 ProcessBuilder를생산 오류 .exe를 :: 디렉터리 이름이 잘못되었습니다
public class HMetis {
private String exec_name = null;
private String[] hmetis_args = {"hmetis.exe", "null", "2", "1", "10", "1", "1", "1", "0", "0"};
private Path path;
private File file;
public HMetis(String hgraph_exec, String hgraph_file) {
this.exec_name = hgraph_exec;
this.hmetis_args[1] = hgraph_file;
}
public void runHMetis() throws IOException {
this.path = Paths.get("C:\\hMetis\\1.5.3-win32");
this.file = new File(path+"\\"+this.exec_name+".exe");
ProcessBuilder pb = new ProcessBuilder(this.hmetis_args);
pb.directory(this.file);
try {
Process process = pb.start();
} finally {
// do nothing
}
}
}
를 사용하여 기본 Windows .exe 파일을 실행하려면 다음 Java 코드를 메시지에서 디렉토리 이름이 완전히 형성되고 OK 인 것처럼 보이지만 아래 오류가 발생합니다 !! 어떤 제안을 해주시겠습니까?
Cannot run program "hmetis.exe" (in directory "C:\hMetis\1.5.3-win32\hmetis.exe"):CreateProcess error=267, The directory name is invalid
실행 파일 이름을 디렉토리 경로에 추가하는 것 같습니다. –
[Java ProcessBuilder를 사용하여 여러 인수가있는 Windows .exe 파일을 실행하면 예상대로 출력 파일이 생성되지 않습니다.] (http://stackoverflow.com/questions/17809295/running-windows-exe-file-with-multiple- arguments-using-java-processbuilder-is-n) 같은 문제에 대해 새로운 질문을 시작하는 대신 이전 질문을 수정하십시오. 당신은 또한 당신에게 내 조언의 1sat 포인트를 무시한 것 같습니다. 그렇다면이 중복 질문은 왜 다른 것입니까? –
@Andrew는 중복되지 않습니다. 서로 다른 관찰을하는 두 가지 사례입니다. 이전에 묻는 질문에 아마도 .exe 파일은 오류 메시지를 생성하지 않고 실행 중이지만 .exe 파일은 예상대로 작동하지 않습니다. – joarderm