This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I have jdk 1.4 installed on my computer.Whenever I write a sample program I'm able to compile it but on running the program from cmd prompt it gives the following error message:
Exception in thread "main" java.lang.UnsupportedClassVersionError: DateTest (Uns upported major.minor version 49.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 error message means that you have compiled your code with JDK 1.5, and now you are trying to run it on Java 1.4.
You can run Java programs compiled with an older version on a newer version, but not the other way around. (So compiling on JDK 1.4 and running on Java 5 works, but not compiling on JDK 1.5 and running on Java 1.4).
If your code needs to run on Java 1.4, then use JDK 1.4 instead of JDK 1.5.