Java/Maven 混淆“不支持的major.minor 版本 51.0”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26283502/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java/Maven confusion 'Unsupported major.minor version 51.0'
提问by Ole Spaarmann
I am trying to download and install this Maven plugin:
我正在尝试下载并安装这个 Maven 插件:
https://github.com/mirkonasato/graphipedia
https://github.com/mirkonasato/graphipedia
I cd
in the directory and run
我cd
在目录中运行
mvn clean install
I installed mvn today with homebrew on a Mac so it should be up to date. The error I'm getting is:
我今天在 Mac 上用自制软件安装了 mvn,所以它应该是最新的。我得到的错误是:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project graphipedia-dataimport: Compilation failure
[ERROR] error: Exception thrown while constructing Processor object: org/neo4j/kernel/impl/annotations/ServiceProcessor : Unsupported major.minor version 51.0
I googled this error and found a couple of people saying, the reason might be an old Java Version. So I checked in my System Preferences and it says Java 7.
我在谷歌上搜索了这个错误,发现有几个人说,原因可能是旧的 Java 版本。所以我检查了我的系统偏好设置,它说 Java 7。
But I didn't really trust that and ran
但我并不真的相信这一点并跑了
mvn --version
Which gave me this output
这给了我这个输出
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T22:58:10+02:00)
Maven home: /usr/local/Cellar/maven/3.2.3/libexec
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: de_DE, platform encoding: MacRoman
OS name: "mac os x", version: "10.9.5", arch: "x86_64", family: "mac"
I am confused. Why is Java v. 1.6 here? And how do I fix this? I just want to use this nice java app.
我很迷惑。为什么这里是 Java v. 1.6?我该如何解决这个问题?我只想使用这个不错的 Java 应用程序。
Oh, and the pom.xml from the Graphipedia App looks like this. Thought it might be helpful as well
哦,Graphipedia 应用程序中的 pom.xml 看起来像这样。认为它也可能有帮助
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.graphipedia</groupId>
<artifactId>graphipedia-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Graphipedia Parent</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<neo4j.version>2.0.0</neo4j.version>
</properties>
<modules>
<module>graphipedia-dataimport</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-asl</artifactId>
<version>4.1.4</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-kernel</artifactId>
<version>${neo4j.version}</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-lucene-index</artifactId>
<version>${neo4j.version}</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-graph-algo</artifactId>
<version>${neo4j.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
采纳答案by Cheese Daneish
This error means you are trying to execute java bytecode with a java runtime that is older than the java installation the code was compiled with. If you're using eclipse, check window | preferences | java | compiler and make sure the version isn't newer than 1.6.
此错误意味着您正在尝试使用比编译代码时使用的 java 安装更旧的 java 运行时执行 java 字节码。如果您使用的是 eclipse,请检查 window | 偏好 | 爪哇| 编译器并确保版本不高于 1.6。
Or you can upgrade the installation of java that maven is trying to use to run it.
或者您可以升级 maven 试图用来运行它的 java 的安装。