Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have downloaded the java jdk in the terminal window of Ubunutu. I am trying to trace the number of system calls a No-op java program runs for my computer science class. the program looks like so:

/* Java No-op program */

public class Noop {
  public static void main(String args[]) {

very simple.

It compiles using javac and then in my directory, I get a Noop.class file. But when I try java Noop to run the program I get this error

Exception in thread "main" java.lang.UnsupportedClassVersionError: Noop : Unsopported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass( at 142) at at$000( at$ at Method) at at java.lang.ClassLoader.loadClass( at sun.misc.Launcher$AppClassLoader.loadClass( at Java.lang.ClassLoader.loadClass( could not find the main class: Noop. Program will exit.

I have tried running other java programs that I know work, and same result.

Please Help.

share|improve this question
Is your JRE(Java Runtime Environment) up to date? – Fabián H. jr. Feb 5 '12 at 5:25

Sounds like your java doesn't match your javac. What output do you get from running java -version and javac -version?

share|improve this answer
Yeah when I did that it said my java compiler is 1.0.7_147 but my java is just 1.6.0_23. How do I fix this/update my java? – andrewpw Feb 5 '12 at 8:22
That's a really strange version of javac. What do you get from running type java and type javac? Although to make a long story short, if it's practical, I think the most expedient solution (and simplest to explain) is just to download the JDK straight from Sun/Oracle‌​. – jjlin Feb 5 '12 at 8:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .