i m using window xp and
jdk1.6.0.
i set environment variables as follow
user variables i creat new and in variable name "classpath" and in variable value .;C:\Program Files\Java\jdk1.6.0\bin;.;C:\World
after that i edit system variable as follow
i edit variable "path"
in variable value I append "C:\Program Files\Java\jdk1.6.0\bin" right side so now system variable is"%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Java\jdk1.6.0\bin"
After all this I restart p.c.
now i make program and save in c:\world
my program"HelloWorld.java" is as given below

package world;

class HelloWorld
{
public static void main(String a[])
{System.out.println("hello ji kya haal hai");
 }
}

After that in command prompt i run following command:

C:\>set CLASSPATH=.;C:\;

C:\>set CLASSPATH // see what we have in CLSSPATH
CLASSPATH=.;C:\;

C:\>cd world

C:\world\javac HelloWorld.java

C:\world>java world.HelloWorld

Exception in thread "main" java.lang.UnsupportedClassVersion:Bed version n
umber in .class file 
world/HelloWorld)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(unknown Source)
        at java.security.SecureClassLoader.defineClass(unknown Source)
        at java.net.URLClassLoader.defineClass(unknown Source)
        at java.net.URLClassLoader.access$1(unknown Source)
        at java.net.URLClassLoader$1.run(unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(unknown Source)
        at java.lang.ClassLoader.loadClass(unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(unknown Source)
        at java.lang.ClassLoader.loadClass(unknown Source)

so plz help me

Hallo

I'm not sure that this is the answer, but be sure to validate that you are compiling to the right version and that your a running with that version of the JRE otherwise your will the get an error as the one you describe.

Hope that helps.

Regards

Per

I don't see a reason to set the CLASSPATH, JAVA is absolutely happy to run just on PATH setup.
Your CLASSPATH seting are strange .;C:\Program Files\Java\jdk1.6.0\bin;.;C:\World What is purpose of that extra semicolon and dot which I marked with red?
And why did you set this CLASSPATH when after restart you change it to C:\>set CLASSPATH=.;C:\;

Make shure to put semicolon on the end of string in PATH %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Java\jdk1.6.0\bin; I had bad experience with this missing semicolon while working with MySQL

most likely an old java.exe, javaw.exe, and possibly javaws.exe got left behind somewhere in the windows installation directory or a subdirectory.
Find and remove those.
Also remove the new JDK and reinstall to a directory with no spaces in it, as it doesn't particularly like that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.