10

I'm following this link to install Oracle Java 8.

Maybe I got this wrong, but I suppose JAVA_HOME should be set after installing 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)

Thanks!

2 Answers 2

15

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

export JAVA_HOME=/usr/lib/jvm/java-8-oracle

and you can also test which Java is active with

java -version

or

java -fullversion
3
  • alright, I thought such variable would set. Thanks!
    – resilva87
    Mar 26, 2015 at 2:34
  • actually, webupd8.org/2012/09/… says doing a 'sudo apt-get install oracle-java8-set-default' would set them (although that didn't work for me).
    – Bachi
    Oct 27, 2015 at 13:27
  • 1
    All Java environment variables are set in /etc/profile.d/jdk.sh, which is a file installed by oracle-java8-set-default and is read by the shell on start-up.
    – kYuZz
    Jul 19, 2016 at 11:27
13

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.

3
  • 3
    "you need to logout and login back again" that was the missing piece for me!
    – idbrii
    Aug 1, 2016 at 15:23
  • Pardon me but from the question I infer that the user already did that and he didn't get the result he was expecting (that is, having, among maybe others, the JAVA_HOME environment var set up.
    – Pere
    Mar 10, 2017 at 17:21
  • Thanks. This answer indirectly explains how to get rid of JAVA_HOME too. i.e. rm -rf /etc/profile.d/jdk.*. I've purged the webupd8 packages, but this variable was sticking and breaking stuff. This post was the only place I found explaining where the remnants were located.
    – tresf
    Jan 31, 2019 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.