由于近期公司需求,我找到了个maven教程:http://wentao365.iteye.com/blog/903396

安装maven其实很简单,就是在Apache官网下载需要的maven包,然后配置环境变量就能跑。(现在的这些工具真方便啊。都不用安装的,什么注册表之类的傻傻分不清。)

配置完,兴奋的打开命令行:“mvn -version”报错了!

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)

究其原因呢,就是我的java版本太低了,maven版本太高导致的。高版本的Java编译的maven,运行在了低版本的Java上就会出现这样的问题。

知道问题所在就好对症下药了,我有两种方案:一种是升级java版本,一种就是重新下载低版本的maven了。

我由maven3.3.3换成了maven3.0.5,后命令成功执行。

C:\Users\Administrator>mvn -version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 21:51:
28+0800)
Maven home: D:\apache-maven-3.0.5\bin\..
Java version: 1.6.0_43, vendor: Sun Microsystems Inc.
Java home: D:\Program Files (x86)\Java\jdk1.6.0_43\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

mvn -v 报错解决办法的更多相关文章

  1. sphinx :undefined reference to `libiconv' 报错解决办法

    sphinx :undefined reference to `libiconv' 报错解决办法   2013-11-30 21:45:39 安装sphinx时不停报错...郁闷在make时报错,错误 ...

  2. spring boot jpa 使用update 报错解决办法

    在spring boot jpa 中自定义sql,执行update操作报错解决办法: 在@Query(...)上添加 @Modifying@Transactional注解

  3. Aasible中cryptography兼容性报错解决办法

    Aasible中cryptography兼容性报错解决办法 1 Ansible中使用ansible --version查看版本,报错信息如下: ERROR! Unexpected Exception, ...

  4. sysctl -P 报错解决办法

    sysctl -P 报错解决办法问题症状修改 linux 内核文件 #vi /etc/sysctl.conf后执行sysctl  -P 报错error: "net.bridge.bridge ...

  5. R语言安装openxl包报错解决办法

    在R语言中使用openxlsx包,会报错 解决办法就是: 下载安装Set-Rtool,安装时注意勾选对话框 然后在R中运行以下代码: Sys.setenv("R_ZIPCMD" = ...

  6. sysctl -P 报错解决办法 error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key

    error: "net.bridge.bridge-nf-call-ip6tables" is an unknown keyerror: "net.bridge.brid ...

  7. Authentication token manipulation error报错解决办法

    Authentication token manipulation error报错解决办法 #参考http://blog.163.com/junwu_lb/blog/static/1916798920 ...

  8. springboot x.x.x RELEASE pom 第一行报错解决办法

    springboot x.x.x RELEASE pom 第一行报错解决办法 在pom.xml 文件的properties中加入maven jar插件的版本号 <properties> & ...

  9. npm install 报错解决办法

    npm install 报错解决办法 原因是因为node_modules可能有意外改动,导致依赖库不完整,删除项目下的node_modules,在你的项目目录下,重新执行npm install,这会重 ...

随机推荐

  1. win10 设置软件开机启动项失效

    问题重现: win10系统,只要是图标右下角带盾牌标志的软件,加入系统的启动文件夹:如:C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Sta ...

  2. c++ 一个cpp文件如何调用另一个cpp文件已经定义的类?我不想重复定义

    文件test1.cpp有类class A;文件test2.cpp有类class B.如在test2.cpp中想用A:#include "test1.cpp" 当然一般的做法是将类的 ...

  3. ASP.NET项目使用MYSQL数据库部署到IIS服务器找不到请求的.Net Framework Data Provider解决方案

    使用MySQL开发过程中在自己的机器上跑项目是没有问题的,但在实际部署到服务器上的时候就发生“找不到请求的.Net Framework Data Provider解决方案”错误,在排除项目本身原因之后 ...

  4. SPOJ GSS5 Can you answer these queries V ——线段树

    [题目分析] GSS1上增加区间左右端点的限制. 直接分类讨论就好了. [代码] #include <cstdio> #include <cstring> #include & ...

  5. angular中ng-repeat去重

    [html] view plain copy print?在CODE上查看代码片派生到我的代码片 <div ng-app="myApp" ng-controller=&quo ...

  6. 作业调度方案(codevs 1156)

    题目描述 Description 我们现在要利用m台机器加工n个工件,每个工件都有m道工序,每道工序都在不同的指定的机器上完成.每个工件的每道工序都有指定的加工时间. 每个工件的每个工序称为一个操作, ...

  7. AtCoder Regular Contest 095E - Symmetric Grid

    $n \leq 12,m \leq 12$,$n$行$m$列小写字母,现可做无数次操作:交换两行:交换两列.问是否有可能把他变成中心对称的. 没有去想分组枚举的复杂度QAQ 行和列的操作顺序是随意的. ...

  8. PHP 之命名空间

    文件A.php namesspace a\b; Class User{ function get_user(){ echo 'this is A Class'; } } 文件B.php namessp ...

  9. grequests----golang的requests库

    github.com/levigross/grequests: A Go "clone" of the great and famous Requests library 特点: ...

  10. asp.net MVC最简单的增删查改!(详)

    折腾了两天搞出来,但原理性的东西还不是很懂,废话不多说上图上代码 然后右键models,新建一个数据模型 注意我添加命名为lianxi 添加后如上 接下来在controllers添加控制器还有在Vie ...