Search code examples
pythonsikulipyjnius

JRE_HOME not found on pip jnius installation


Trying to install jnius from pip (it is a requirement to pip install sikuli).

This is the error I get when I am trying to install:

enter image description here

Are the variables correctly defined?

enter image description here

Does anyone understand why it keeps saying that it can't find JRE_HOME?

Edit: My path variable is:

enter image description here


Solution

  • The setup.py contains:

    jdk_home = environ.get('JDK_HOME')
    if not jdk_home:
        jdk_home = subprocess.Popen('readlink -f /usr/bin/javac | sed "s:bin/javac::"',
                shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
    if not jdk_home:
        raise Exception('Unable to determine JDK_HOME')
    
    jre_home = environ.get('JRE_HOME')
    if not jre_home:
        jre_home = subprocess.Popen('readlink -f /usr/bin/java | sed "s:bin/java::"',
                shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
    if not jre_home:
        raise Exception('Unable to determine JRE_HOME')
    

    Somehow you pass the first error check Unable to determine JDK_HOME start a new cmd window and try again.

    Write a small code where you test these:

    import os
    print os.environ.get('JDK_HOME')
    print os.environ.get('JRE_HOME')
    

    They are not case sensitive I tested it.

    EDIT: Check the environment variables:

    import json, os
    print json.dumps(dict(os.environ), indent = 2)