Loading...

STORIES

Specify the Java Version for Maven

Need to run some Java with Maven, but it's throwing errors? If you suspect you're using the wrong version, set the JAVA_HOME environment variable.

You may have already downloaded and installed the SDK for Java 11, but you need version 8. Whatever the case may be, just set JAVA_HOME, for example:

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

Confirm that the system and Maven is picking this up:

java -version
mvn -v

Done!