Tag Archives: mvn -v error

[Solved] mvn -v error: Unsupported major. minor version 51.0

Mvn – v error: Unsupported major minor version 51.0

Error reason: Maven version and JDK version do not match

java.lang.UnsupportedClassVersionError: org/apache/lucene/store/Directory : Unsupported major.minor version 51.0
Could not find the main class: org.codehaus.plexus.classworlds.launcher.Launcher. Program will exit.

 

Solution:
J2SE 8=52,
J2SE 7=51,
J2SE 6.0=50,
J2SE 5.0=49,
JDK 1.4=48,
JDK 1.3=47,
JDK 1.2=46,
JDK 1.1=45

From the above correspondence can be seen from the jdk7 version error; because the maven version and jdk version is not compatible, I use the maven is 3.3.9, jdk is 1.6.0, and then replaced a jdk1.8.0 version will be able to; specific cmd use echo %JAVA_HOME% command to check their environment variables configured in the version;
Sometimes you will see version 1.8.0 with the java -version command, but you may see a different version of jdk with the echo %JAVA_HOME% command;
This phenomenon is mainly due to a bad personal habit of configuring multiple versions of jdk in environment variables and introducing only one of them in the path, which actually has disadvantages, for example, Tomcat will read the information in environment variables named JAVA_HOME by default, but not JAVA_HOME2;
So it is better to name the environment variable JAVA_HOME, and not to configure more than one jdk;