Maven 3.3.9 mvn -version Error:java.lang.UnsupportedClassVersionError

Description

在下载 Maven包,配置了环境变量之后,在命令行执行 mvn -version(or -v) 报错:

 1 Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/ma
 2 ven/cli/MavenCli : Unsupported major.minor version 51.0
 3         at java.lang.ClassLoader.defineClass1(Native Method)
 4         at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
 5         at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
 6         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
 7 1)
 8         at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
 9         at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
10         at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
11         at java.security.AccessController.doPrivileged(Native Method)
12         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
13         at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(Cl
14 assRealm.java:401)
15         at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(
16 SelfFirstStrategy.java:42)
17         at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadCl
18 ass(ClassRealm.java:271)
19         at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
20 .java:254)
21         at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
22 .java:239)
23         at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launch
24 er.java:144)
25         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
26 cher.java:266)
27         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
28 a:229)
29         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
30 uncher.java:415)
31         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
32 356)

Caused By

JAVA_HOME 中 jdk版本过低。虽然用的是 jdk6,但我下载的 maven 是最新的 3.3.9,把环境变量中的 JAVA_HOME 指向 jdk8,结果正常。

Solution

提高 JAVA_HOME 中 jdk 版本。

时间: 2024-10-14 21:42:33

Maven 3.3.9 mvn -version Error:java.lang.UnsupportedClassVersionError的相关文章

【原创】Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0

有多个情况造成这种异常,以下列举 1.JDK 和 MAVEN 版本不兼容 从apache 官网下载maven bin 版本,我下的是apache-maven-3.3.3-bin.zip. 下载下来的安装包解压到你的工作目录下.如:E:\开发\apache-maven-3.3.3,配置环境变量,MAVEN_HOME,再把%MAVEN_HOME%\bin配置到 path中. 安装java jdk,配置JAVA_HOME.打开cmd ,输入mvn -r,如果会报错.java.lang.Unsuppor

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0

me 的 maven 项目, 右键 update dependencies , 出现 错误 Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.la

java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class org.

1.错误描述 严重: Exception starting filter struts2 java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class org.apache.commons.lang3.StringUtils) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(Webap

Maven运行时异常java.lang.UnsupportedClassVersionError的解决方案

我用的Maven版本为最新版:3.3.9,但是我执行一个简单的clean命令会报如下错误: Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.la

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/ma ven/cli/Maven

安装maven 中出现如下异常: 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.defineClassCo

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/ma ven/cli/Maven

安装maven 中出现例如以下异常: 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.defineClass

Tomcat - java.lang.UnsupportedClassVersionError:Unsupported major.minor version 51.0 (unable to load class com.microsoft.sqlserver.jdbc.SQLS

今天使用Tomcat连接sql Server 2008 enterprise的时候,报错: HTTP Status 500 - Servlet execution threw an exception type Exception report message Servlet execution threw an exception description The server encountered an internal error that prevented it from fulfil

Error: java.lang.UnsupportedOperationException: Not implemented by the HftpFileSystem FileSystem imp

Error: java.lang.UnsupportedOperationException: Not implemented by the HftpFileSystem FileSystem implementation at org.apache.hadoop.fs.FileSystem.getScheme(FileSystem.java:214) at org.apache.hadoop.fs.FileSystem.loadFileSystems(FileSystem.java:2365)

Druid出现DruidDataSource - recyle error - recyle error java.lang.InterruptedException: null异常排查与解决

线上的代码之前运行的都很平稳,突然就出现了一个很奇怪的问题,看错误信息是第三方框架Druid报出来了,连接池回收连接时出现的问题. 2018-05-14 20:01:32.810 ERROR [hystrix-UpgradeResultReportController-49][DruidDataSource.java:1297] - recyle error java.lang.InterruptedException: null at java.util.concurrent.locks.Ab