Getting JAVA_HOME KeyError while importing autoclass
See original GitHub issueBefore formatting my computer, jnius used to work perfectly. But after formatting and reinstalling again, from jnius import autoclass doesn’t seem to work anymore. Whenever I type that in Python shell, I get this error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/jnius/__init__.py", line 13, in <module>
from .reflect import *
File "/usr/local/lib/python2.7/dist-packages/jnius/reflect.py", line 14, in <module>
class Class(with_metaclass(MetaJavaClass, JavaClass)):
File "/usr/local/lib/python2.7/dist-packages/six.py", line 808, in __new__
return meta(name, bases, d)
File "jnius/jnius_export_class.pxi", line 43, in jnius.MetaJavaClass.__new__ (jnius/jnius.c:17159)
File "jnius/jnius_export_class.pxi", line 65, in jnius.MetaJavaClass.resolve_class (jnius/jnius.c:17555)
File "jnius/jnius_env.pxi", line 11, in jnius.get_jnienv (jnius/jnius.c:3320)
File "jnius/jnius_jvm_dlopen.pxi", line 89, in jnius.get_platform_jnienv (jnius/jnius.c:3248)
File "jnius/jnius_jvm_dlopen.pxi", line 48, in jnius.create_jnienv (jnius/jnius.c:2647)
File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
raise KeyError(key)
KeyError: 'JAVA_HOME'
My JAVA_HOME is set to /usr/lib/jvm/java-7-openjdk-amd64
Do I need to add something else to PATH? Do I need to set path for Python?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:2
- Comments:10
Top Results From Across the Web
importing pyjnius in python shell gives KeyError - Stack Overflow
#!/usr/bin/python from jnius import autoclass # do something here. I can run this without getting any error but when I try to write...
Read more >pyjnius 'JAVA_HOME' error - Google Groups
I am having trouble with pyjnius while trying to execute the following code; import jnius. I am getting the following error;
Read more >pyjnius KeyError: 'JAVA_HOME' on Pycharm
Hello there,I am trying to compile code with jnius in my pycharm python compiler but I get an error like the following. I...
Read more >barcodes scanner for kivy - Python Forum
Does anyone know of another bar code scanner for Kivy? I tried using this one but i get a key error when i...
Read more >kivy@groups.io | Messages
[python-for-android:master] New Comment on Issue #653 App crashes ... New Comment on Issue #209 Getting JAVA_HOME KeyError while importing autoclass By.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@darleison @brandomr I don’t know whether you managed to find a solution, but that worked for me:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 export PATH=$JAVA_HOME/bin:$PATH
(path / or java version may differ, make sure to check it before copying)Hope that helps:)
Hello Petar.
Yes. I did manage to solve it but with a twist -
I did this and it worked.