I've been trying to install and configure maven-3.3.3 for the past hour. When I type:
mvn --version
I get this error in cmd
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/ma
ven/cli/MavenCli : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
1)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(Cl
assRealm.java:401)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(
SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadCl
ass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
.java:254)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
.java:239)
at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launch
er.java:144)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:266)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
356)
I've followed the official guide and also looked at several other blogs and forums.
Here are my system variables
JAVA_HOME = C:\Program Files\Java\jdk1.6.0_45
M2_HOME = C:\Program Files\Apache Software Foundation\apache-maven-3.3.3
MAVEN_OPTS = -Xms256m -Xmx512m
And I've added the following lines at the end of Path variable
%M2_HOME%\bin;%JAVA_HOME%\bin
Someone please tell me why I am getting this error. Thanks in advance.
P.S
java -version
gives
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)
You need to update to Java 7, as the class version 51.0
means, that it was built for Java 7. By the way, these are the valid versions:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With