Mr. Butterworth
Mr. Butterworth

Reputation: 145

linux - $JAVA_HOME

New to 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"

Really I just wanna set the $JAVA_HOME because I think I'll use it later.

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. I'm not sure what "providing" means. :(

also, how do I copy (Ctrl+c) the returned folder address?

Thanks in advance :)

Upvotes: 1

Views: 445

Answers (1)

Edwin Buck
Edwin Buck

Reputation: 70909

You do not need to set JAVA_HOME unless you want to ensure that a specific Java is the one you use. In your case, you only have one specific Java installed.

That said, if you really want to configure this, add the following lines to your ~/.bashrc file

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=${JAVA_HOME}/bin:${PATH}
export PATH

somewhere below the JAVA_HOME lines detailed above.

Upvotes: 2

Related Questions