I have the following Java code to run a native Windows .exe file using ProcessBuilder
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
}
}
}
after running this code I am getting the below error although from the message it seems the directory name is fully formed and OK !! Any suggestions please?
Cannot run program "hmetis.exe" (in directory "C:\hMetis\1.5.3-win32\hmetis.exe"):CreateProcess error=267, The directory name is invalid