java 安装 oracle-java8-set-default 后未设置 webupd8 JAVA_HOME
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29269829/
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
webupd8 JAVA_HOME not set after installing oracle-java8-set-default
提问by resilva87
I'm following this linkto install Oracle Java 8.
我正在按照此链接安装 Oracle Java 8。
Maybe I got this wrong, but I suppose JAVA_HOME should be set after installing oracle-java8-set-default
.
也许我弄错了,但我想 JAVA_HOME 应该在安装oracle-java8-set-default
.
If I echo $JAVA_HOME
or printenv | grep -i java
nothing comes up. I'm using Linux Mint 17.1 (Rebecca)
如果我echo $JAVA_HOME
或printenv | grep -i java
什么都没有出现。我正在使用 Linux Mint 17.1 (Rebecca)
Thanks!
谢谢!
回答by Elliott Frisch
Your JAVA_HOME will not be set by the webupd8 method, and you don't normally need it (because the update-java-alternatives
script manages the environment). If you're looking for the folder it's under "/usr/lib/jvm" and you can certainly do
您的 JAVA_HOME 不会被 webupd8 方法设置,您通常不需要它(因为update-java-alternatives
脚本管理环境)。如果您正在寻找位于“/usr/lib/jvm”下的文件夹,您当然可以这样做
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
and you can also test which Java is active with
并且您还可以测试哪个 Java 处于活动状态
java -version
or
或者
java -fullversion
回答by garfield
You need to run also the command:
您还需要运行以下命令:
sudo apt-get install oracle-java8-set-default
as described in WebUpd8 site, then you need to logout and login back again, since the specific command creates two files under /etc/profile.d, named jdk.sh and jdk.csh which populate the environment with JAVA_HOME etc.
如WebUpd8 站点中所述,那么您需要注销并重新登录,因为特定命令在 /etc/profile.d 下创建了两个文件,名为 jdk.sh 和 jdk.csh,它们使用 JAVA_HOME 等填充环境。