Maven异常Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/mav(代

Posted N!CE波

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Maven异常Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/mav(代相关的知识,希望对你有一定的参考价值。

一、异常信息

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.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        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(ClassRealm.java:401)
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(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(Launcher.java:144)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:266)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

二、解决办法

1、检查你的JAVA_HOME环境变量是否配置正确,通过echo $JAVA_HOME验证下(我遇到的情况就是这种)

2、检查你的maven依赖的jdk版本和你本地装的jdk版本是否兼容

以上是关于Maven异常Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/mav(代的主要内容,如果未能解决你的问题,请参考以下文章

Jenkins的slave异常:Exception in thread "main" java.lang.ClassNotFoundException: hudson.remoti

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/ma v

日常Exception第二十三回:Maven导入异常Maven dependencies are failing with a 501 error: user https://repo.maven

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/Ma

致命错误:未捕获的异常 'mysqli_sql_exception' 带有消息 'No index used in query/prepared statement'

(转)Exception in thread "main" java.lang.NullPointerException java报空指针异常