Unsupported major.minor version 51.0; nested exception is java.lang.UnsupportedClassVersionError


While doing mvn compile i got the following error

Unsupported major.minor version 51.0; nested exception is java.lang.UnsupportedClassVersionError

After going through google links, the error seems to be the JDK version for compilation is different that JDK version executing it .

But when i do , java -version and javac -version , I got the same result .

java version “1.7.0_51”

Java(TM) SE Runtime Environment (build 1.7.0_51-b13)

Then I decided to check java version used by maven and Aha !

frobplant-lm:test hrsht$ mvn -version

Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T09:37:52-08:00)

Maven home: /usr/local/Cellar/maven/3.2.1/libexec

Java version: 1.6.0_65, vendor: Apple Inc.

Maven was using java  1.6 and I had java 1.7 in the path.

To fix this I changed the path of maven java version by setting JAVA_HOME to java 1.7 .

Cheers.

2 thoughts on “Unsupported major.minor version 51.0; nested exception is java.lang.UnsupportedClassVersionError

  1. I have noticed you don’t monetize your blog, don’t waste your traffic,
    you can earn additional cash every month because you’ve got high quality content.
    If you want to know how to make extra bucks, search for:
    Mertiso’s tips best adsense alternative

  2. I have checked your website and i’ve found some duplicate content, that’s why you don’t rank high in google, but there is a tool
    that can help you to create 100% unique articles, search
    for; Boorfe’s tips unlimited content

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s