We get issues like
- "The JAVA_HOME environment variable is not defined correctly.
This environment variable is needed to run this program.
JAVA_HOME should point to a JDK not jre."
- "No compiler is provided in this environment. Perhaps you are running on a JRE rather than JDK"
- Maven unable to find JAVA_HOME.
To solve these issues on Ubuntu 18.04.
- Update apt : Advanced Package Tool
sudo apt update
- Install JDK: Skip if JDK already installed
sudo apt install openjdk-8-jdk
- Set JAVA_HOME
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
- Check if JAVA_HOME is set
echo $JAVA_HOME
- Add Java bin to path variable
export PATH=$PATH:$JAVA_HOME/bin
- verify PATH
echo $PATH
- Verify Java setup
java -version
- Verify maven
mvn -v
If everything goes right your issue is solved and you are ready to dive into java development.
0 Comments