In windows command line, if I type java -version
, I get
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
and python -v
#snip
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
In python if use
call("java -version")
I get
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode, sharing)
Is there a way I can force my python to use the 64bit JVM?
When you call java -version
in your windows command line it will consult the PATH
environment variable to locate the java
executable.
subprocess.call
which I assume you are using there seems to not use that same windows PATH
variable on Windows in your case. Perhaps if you enforced that it spawns a shell (which is not considered safe according to the docu) it would work.
call("java -version", shell=True)
In case you have multiple Java installations (ie a 64 bit and 32 bit JRE), the easiest solution would be to hardcode the absolute path to your java 64 bit executable
call("C:\\Program Files\\Java\\jre7\\bin\\java -version")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.