I'm building a simple GUI for a python script with Java and I can't get it to run the script.
The method I am using to run cmd commands is this:
private void executeCommand(String command) {
try {
Process proc = Runtime.getRuntime().exec(command);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
proc.waitFor();
while (in.ready()) {
System.out.println(in.readLine());
}
} catch (Exception e) {
e.printStackTrace();
}
}
I call the method like this:
executeCommand("cmd.exe /c subliminal download -l en -l ro " + selectedFile.getAbsolutePath());
The command runs perfectly if executed in command prompt but when called from Java nothing happens. Any ideas?