Java Home ¶
If you are getting java_home is not defined correctly in Ubuntu
, then you are at right place.
I was getting this error as I was trying to update the Java home in ~\.bashrc
and ~\.bash_profile
. Follow these steps to solve this issue.
-
Open the
/etc/environment
file asvim /etc/environment
-
Then set
java_home
usingJAVA_HOME="/usr/lib/jvm/java-8-oracle" export JAVA_HOME
-
Open bash profile as
vim ~\.bash_profile
-
Then add the following,
. /etc/environment
It will load the
/etc/environment
every time terminal is started -
Then confirm the path using
echo $JAVA_HOME