java 如何设置JDK_HOME
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41018202/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set JDK_HOME
提问by Mara
I try to work with the snappy module in python using conda as a virtuelenv. I have in Linux Mint 18 Sarah.
我尝试使用 conda 作为美德使用 python 中的 snappy 模块。我在 Linux Mint 18 Sarah 中有。
I have the module snappy
, but if i try to test it with the following code: from snappy import ProductIO
I got the following response:
我有模块snappy
,但如果我尝试使用以下代码对其进行测试:from snappy import ProductIO
我得到以下响应:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mara/.snap/snap-python/snappy/__init__.py", line 61, in <module>
import jpyutil
ImportError: No module named 'jpyutil'
Thus, I tried to get jdk with pip install -i https://pypi.anaconda.org/pypi/simple jpy
. And i got: Error: Environment variable "JDK_HOME" must be set to a JDK (>= v1.6) installation directory
因此,我尝试使用pip install -i https://pypi.anaconda.org/pypi/simple jpy
. 我得到:Error: Environment variable "JDK_HOME" must be set to a JDK (>= v1.6) installation directory
Thus, I installed jdk1.8.0_111
. I used this instruction: https://community.linuxmint.com/tutorial/view/1372. But I don't know how to set the JDK_HOME variable in a correct way. I tried it using an instruction for JAVA_HOME (https://askubuntu.com/questions/175514/how-to-set-java-home-for-java) and write JDK_HOME="/opt/java/jdk1.8.0_111"
in the environment file but it doesn't work. I got the same Error like before changing the environment file.
因此,我安装了jdk1.8.0_111
. 我使用了这个指令:https: //community.linuxmint.com/tutorial/view/1372。但我不知道如何以正确的方式设置 JDK_HOME 变量。我使用 JAVA_HOME ( https://askubuntu.com/questions/175514/how-to-set-java-home-for-java)的指令尝试了它并写入JDK_HOME="/opt/java/jdk1.8.0_111"
环境文件,但它不起作用。我在更改环境文件之前遇到了相同的错误。
Hope somebody can help me.
希望有人可以帮助我。
采纳答案by Mr. Polywhirl
Create a symbolic link:
创建符号链接:
ln -s /opt/java/jdk1.8.0_111 /opt/java/latest
Directory listing for /opt/java
:
目录列表/opt/java
:
.
jdk1.8.0_111/
latest/ -> /opt/java/jdk1.8.0_111
Set exports
设置导出
export JDK_HOME=/opt/java/latest
export JAVA_HOME=${JDK_HOME}
export PATH=$PATH:${JAVA_HOME}/bin
Now, when you install a new version of the Java JDK, simply alter your latestsymbolic link.
现在,当您安装新版本的 Java JDK 时,只需更改最新的符号链接即可。