After upgrading Java from 1.6 to 1.7 x64 (on Windows 7), I cannot run java.exe through the Python 2.7 subprocess
module. The following scripts are used only for work:
import subprocess subprocess.check_call([r"C:\Windows\system32\java.exe"])
Now this is not happening:
Traceback (most recent call last): File ".\tst.py", line 2, in <module> subprocess.check_call([r"C:\Windows\system32\java.exe"]) File "C:\Python27\lib\subprocess.py", line 506, in check_call retcode = call(*popenargs, **kwargs) File "C:\Python27\lib\subprocess.py", line 493, in call return Popen(*popenargs, **kwargs).wait() File "C:\Python27\lib\subprocess.py", line 679, in __init__ errread, errwrite) File "C:\Python27\lib\subprocess.py", line 896, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified
I also confirmed that C:\Windows\system32\java.exe
really exists, is an application, and can be executed from the shell.
What is wrong here?
EDIT: I found that I can run C:\Program Files\Java\jre7\bin\java.exe
from Python, so C:\Windows\system32\java.exe
should be some kind of weird pseudo-shortcut, although technically this is a windows application. Version 1.7 should somehow mess it up, as I just confirmed that version 1.6 is fine.
source share