3

I'm having issues with my maven install. I had several old versions of java installed via various sources: sdkman, home brew, directly, etc. As such my java install seemed like a mess. I've since uninstalled all versions and totally cleaned my sdkman install.

From a totally fresh install of sdkman, followed my java and maven this is what I get.

java --version
openjdk 11.0.6 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.6+10, mixed mode)

which java
/Users/myname/.sdkman/candidates/java/current/bin/java

echo $JAVA_HOME
/Users/myname/.sdkman/candidates/java/current

which mvn
/Users/myname/.sdkman/candidates/maven/current/bin/mvn

mvn -v
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

Any insight?

TimJ
  • 426
  • 4
  • 12

1 Answers1

3

Turns out the issue was that I had a .mavenrc file in my home directory that had its own export of JAVA_HOME. It was pointing to a directory that no longer exists. It meant that no matter what my java install looked like or what export I put in my .bash_profile none of those would have an effect. Updating or removing the JAVA_HOME export or deleting the file resolved this issue for me.

TimJ
  • 426
  • 4
  • 12