This was the error message when I tried running the command "java -cp . Test"

Exception in thread "main" java.lang.UnsupportedClassVersionError: Test : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass( :634)
at .java:277)
at$000(URLClassLoader. java:73)
at$ 212)
at Method)
at ava:205)
at java.lang.ClassLoader.loadClass( 21)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche
at java.lang.ClassLoader.loadClass( 66)
Could not find the main class: Test. Program will exit.

Note that I compiled using this command "javac"
Was the compiling command wrong? because I could run the program from class file produced by eclipse.

This is the content of

import javax.swing.JOptionPane;

public class Test {
public static void main(String [] args) {
System.out.println("Hello World!");
JOptionPane.showMessageDialog(null,"Hello World!!!");