java.lang.UnsupportedClassVersionError: test_hello_world :
 Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)

Why this Happens?
When you did maven build in Java 8 and try to deploy the ear file in Server which uses Java 1.7 then this issue happens.Error means you’re trying to load a Java “class” file that was compiled with a newer version of Java than you have installed.For example, your .class file could have been compiled for JDK 7, and you’re trying to run it with JDK 6.You must have compiled your code with a higher version and trying to run it using a lower version

Solution

Window -> Preferences -> Java -> Compiler and then set "Compiler compliance level" to 1.7