简体   繁体   English

linux-$ JAVA_HOME

[英]linux - $JAVA_HOME

New to Linux ubuntu Linux ubuntu新功能

sudo update-alternatives --config java

returns "There is only one alternative in link group java (providing /usr/bin/java ) /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java " 返回“链接组java(提供/usr/bin/java/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java只有一种选择”

Really I just wanna set the $JAVA_HOME because I think I'll use it later. 真的,我只是想设置$ JAVA_HOME,因为我想以后再使用它。

I think i have to copy (as in Ctrl+c) " /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java " and set it as the $JAVA_HOME but not sure if that's correct because of the "providing" statement mentioned above. 我想我必须复制(如Ctrl + c一样)“ /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java ”并将其设置为$JAVA_HOME但是由于以下原因,不确定是否正确上述“提供”声明。 I'm not sure what "providing" means. 我不确定“提供”是什么意思。 :( :(

also, how do I copy (Ctrl+c) the returned folder address? 另外,如何复制(Ctrl + c)返回的文件夹地址?

Thanks in advance :) 提前致谢 :)

You do not need to set JAVA_HOME unless you want to ensure that a specific Java is the one you use. 除非您要确保使用的是特定的Java,否则无需设置JAVA_HOME。 In your case, you only have one specific Java installed. 就您而言,您仅安装了一种特定的Java。

That said, if you really want to configure this, add the following lines to your ~/.bashrc file 就是说,如果您确实要配置它,请将以下行添加到〜/ .bashrc文件中

JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
export JAVA_HOME

If you are going to go this route, I suggest also adding to your PATH 如果您要走这条路线,建议您也添加到PATH中

PATH=${JAVA_HOME}/bin:${PATH}
export PATH

somewhere below the JAVA_HOME lines detailed above. 在上面详述的JAVA_HOME行下面的某处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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