If anyone can help me with this, it would mean a lot as I've seen similarly answered questions for windows but not many or Linux. I am running I am running Linux mint 20.2 (Uma).
I have a problem where trying to run my maven project, I get the error
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
I have since fully uninstalled java and maven and set up JDK17 and the JAVA_HOME
$ echo $JAVA_HOME
/usr/lib/jvm/jdk-17.0.2
Along with setting the profile
$ grep JAVA_HOME /etc/profile
JAVA_HOME=/usr/lib/jvm/jdk-17.0.2
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME
And .bashrc
$ grep JAVA_HOME ~/.bashrc
JAVA_HOME=/usr/lib/jvm/jdk-17.0.2
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME
I also found a .sh
file in the /etc/profile.d/
that was redirecting JAVA_HOME to the old JDK and have since deleted it.
But even after all of this the problem pressies, I don't know if something is still redirecting JAVA_HOME to the old JDK or I didn't set it up correctly, I also don't know where to look if something is redirecting it or if I have an alias for
since I'm not adept to Linux fully and I haven't used to this system in a while to backtrack my changes.
If anyone has any input on how to solve this problem, it would be greatly appreciated. Thank you all in advance.
Asked by SaltySwan
(11 rep)
Feb 19, 2022, 04:39 PM
Last activity: Apr 10, 2025, 11:05 AM
Last activity: Apr 10, 2025, 11:05 AM