Marcello
Marcello

Reputation: 443

UnsupportedClassVersion error while trying to run simple Java code

I'm trying to compile my programs using the command prompt on Windows 7. I'm having a problem when I during compile. I created a test program:

class test
{
    public static void main (String args[])
    {
        System.out.println("this is working!!!!!!");
    }
}

I use the following instructions from the command line:

cd \ 
cd summer
Javac test.java 
java test

I have even tried using javaw and I get the same message but in a pop-up box

Could not find the main class, program will exit.

image

Any suggestions?

Upvotes: 1

Views: 150

Answers (2)

Akshay
Akshay

Reputation: 26

You are using different versions of JDK. Check the versions on your javac vs java. This error is telling you that your java and compiled class are not same versions. Check your path for configuration, type "set" in dos to see details.

Example: If you compiled your class with javac (version 7) and execute it with java (version 6)

Upvotes: 0

Wenhuang Lin
Wenhuang Lin

Reputation: 214

It seems your JDK and JVM have different editions.

Upvotes: 5

Related Questions