I am trying to run "java -version" using ProcessBuilder:
processBuilder = new ProcessBuilder("java -version");
process = processBuilder.start();
However I get an error:
java.io.IOException: Cannot run program "java -version": CreateProcess error=2, The system cannot find the file specified
When I remove the "-version" and do:
processBuilder = new ProcessBuilder("java");
process = processBuilder.start();
it runs fine and I get the normal help guide output.
How can I get it to run the argument too?