2

I installed Java using

apt install default-jre
apt install default-jdk

whenever I tries to access an app, getting an ERROR:

JAVA_HOME environment variable must be defined

How I can define Java home environment variables

1 Answer 1

2

Open up your $HOME/.bashrc file. Go to the end of the file. There should be an entry that starts with "export". Just above the first "export" place the following, changing the path below, after JAVA_HOME= to where your Java installation resides. Since I use Oracle Java, my path and versions are different.

if [ "$JAVA_HOME" == "" ]; then
    export JAVA_HOME=/usr/lib/jvm/java-8-oracle
fi

This will define JAVA_HOME only if it isn't already defined. I've not seen Java installed the way you've installed yours so I must assume it's Open Java.

Hopefully this helps!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .