Calling Java from Python fails even though 'java' works in Windows command line I tried os.system ('C:\\Windows\\System32\\java.exe') and os.system('C:/Windows/System32/java.exe') etc. and they resulted in the same error. Interestingly, I tried adding the openjdk/jre directory to the PATH and apparently that worked. I still don't understand why the executable there should work when the system32 one doesn't.