Help with an error

I am taking a intro to programming class and the teacher is not very helpful. I have asked him this same question, but it has been about 3 weeks and still no answer! So, maybe someone from here could help.

The computers in our classroom have no problem with running the programs that I write. However; when I try to run the programs on any other computer (at my home or at the school), they come up with this error: (the programs compile just fine)

"Exception in thread "main" java.lang.UnsupportedClassVersionError: test (Unsuppo

rted major.minor version 50.0)

at java.lang.ClassLoader.defineClass0(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$100(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)

at java.lang.ClassLoader.loadClassInternal(Unknown Source)"

The other weird thing I found about this error was that if I type ".class" when trying to run a program from DOS, it gives me this error:

"Exception in thread "main" java.lang.NoClassDefFoundError: test/class"

Has anyone encountered this? I have tried using every resource I have, but nothing I have tried has worked.

Thanks,

cardioman

[1690 byte] By [cardiomana] at [2007-11-26 18:14:03]
# 1
I forgot one thing: on all the computers that I use for java, I am running Windows XP.
cardiomana at 2007-7-9 5:47:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

You are trying to run a class that was compiled with a newer version of java. I.e in this case you compiled the class with java 6 and are trying to run it with a lower version (5 or 1.4.x probably). So you need to either recompile the class(es) using the -target option or update the version of java to 6 on those machines. If you are not sure which version is installed then open a command prompt and type: java -version

YoGeea at 2007-7-9 5:47:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3

Thanks, that makes sense. So, I can only find the JRE version 5.0 on the java website, but I am compiling them using version 6.0. Do you know where the JRE v.6 can be found? Maybe I need to check the CD that came with my textbook.

Thanks again,

cm

I just installed the JRE v.5 and the programs are now running just fine! Thanks a ton!

cm

Message was edited by:

cardioman

cardiomana at 2007-7-9 5:47:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...