EN
Debian - Warning: JAVA_HOME environment variable is not set. - how to solve it?
1
answers
7
points
When I run mvn install commnad to build my java project on Debian 9 I get this warning:
Warning: JAVA_HOME environment variable is not set.
This warning causes that my java build fails.
How can I fix it?
1 answer
7
points
You need to ensure you have installed correct version of java, I suggest jdk 8.
1. To check java version, execute command:
java -version
2. If we install open JDK, the default location should be:
/usr/lib/jvm/java-8-openjdk-amd64
3. Open /etc/profile
vim /etc/profile
4. Set JAVA_HOME path and add java bin directory to the PATH variable. In order to do that, we need to add below 2 lines to /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin
5. Logout from putty, login again
6. Ensure we have java on our PATH by executing below commnad:
echo $PATH
7. Ensure we have $JAVA_HOME env variable:
echo $JAVA_HOME
8. Run mvn install in your java project and warning should be gone.
0 comments
Add comment