简体   繁体   中英

Python - IPython Notebook fails to find the Java executable

I am using IPython Notebook on Windows 7 which needs to call Java executables (.jar)

I set JAVA_HOME to 'C:/Program Files/Java/jdk1.8.0_11/bin' where my jdk is installed, but when I run the program I get the error "... unable to find the java executable!"

Finally I've found a solution adding those lines to my IPython Notebook

import os
java_home = os.environ.get('JAVA_HOME', None)
if not java_home:
    java_path = 'C:/Program Files/Java/jdk1.8.0_11/bin'
    os.environ['JAVA_HOME'] = java_path
else:
    print(java_home)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM