JAVA_HOME not found in linux

 

The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE.

Commands:
  1. nano etc/profile
  2. export JAVA_HOME="/usr/lib/jvm/jdk1.8.0_311"
  3. export PATH=$PATH:$JAVA_HOME/bin
  4. export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_311
  5. sudo gedit /etc/environment
  6. Add "JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"" to /etc/environment
Description of command: 

1) This is the place to give the variable JAVA_HOME the value of the jdk. JDK from oracle is preferred. After editing the file, laptop should restart, so that the value will be set.

2, 3) This two line should be added. When we give this JAVA_HOME a path, this path will be global variable all around the Linux.

4) If after this also there is error: give 4th command to terminal:

We need to update in other places as well.
5,6). We need to update in environment variable as well.

Remark:
This folder 'jdk1.8.0_311' is download from the oracle. This is java version 8.




Comments

Popular posts from this blog