Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu maven The JAVA_HOME environment variable is not defined correctly

I installed maven in Ubuntu 22.04 and I am getting the next error when I try a mvn clean install command:

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

My JAVA_HOME has the next value:

echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-amd64/bin/

Am I missing something?

Thanks!

like image 358
rasilvap Avatar asked Nov 18 '25 13:11

rasilvap


1 Answers

JAVA_HOME needs to be one level up - /usr/lib/jvm/java-11-openjdk-amd64

like image 137
stdunbar Avatar answered Nov 21 '25 10:11

stdunbar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!