Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

This question already has an answer here:

I am trying to run a program on eclipse. I am getting the following error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: Perlinit : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: Perlinit. Program will exit.

Output of java -version is

java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.3) (6b27-1.12.3-0ubuntu1~12.04.1)
OpenJDK Server VM (build 20.0-b12, mixed mode)

Output of javac -version javac 1.6.0_27

Where can I be going wrong?

share|improve this question

marked as duplicate by Seth, BuZZ-dEE, karel, minerz029, mikewhatever Dec 28 '13 at 6:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

The version number "major.minor version 51.0" show which Java was used to run eclipse.

51.0 = Java J2SE 7

To fix your problem you should try to run eclise with Java 7. This can be done by updating your Java configuration:

sudo update-alternatives --config java

Then select a Java 7 version and retry.

If Java 7 isn't installed you can get it with apt-get:

sudo apt-get install default-jdk
share|improve this answer
Thank you, this resolved the same issue for me! –  dotancohen Oct 18 '13 at 11:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.