Java/Maven confusion 'Unsupported major.minor version 51.0'

Ole Spaarmann picture Ole Spaarmann · Oct 9, 2014 · Viewed 31.8k times · Source

I am trying to download and install this Maven plugin:

https://github.com/mirkonasato/graphipedia

I cd in the directory and run

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:

[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.

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.

Oh, and the pom.xml from the Graphipedia App looks like this. Thought it might be helpful as well

<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>

Answer

Cheese Daneish picture Cheese Daneish · Oct 9, 2014

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.

Or you can upgrade the installation of java that maven is trying to use to run it.