This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I am migrating from sdk1.3 to jdk1.5, and when I comile a program it comiled fine,but when I tried to run that program,I got an error message saying that
Exception in thread "main" java.lang.UnsupportedClassVersionError: Hello (Unsupported 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)
I didn't understand what to do next,I changed in classpath,path everywhere from 1.3 to 1.5. Need advice!
You have attempted to load a class running under a VM that does not support that version of the class file. For example, you have (probably) compiled with -target 1.5 on a 1.5 compiler and are now trying to run it on a 1.3 VM.
The API spec. for that specific exception will likely yield more results.
You may be migrating from Java 1.3 to Java 1.5, but for some reason, your "java" interpreter is from Java 1.4.2. You need to configure your system to use the "java" that came with 1.5, assuming that is what compiler you used.
Joined: Mar 07, 2006
now I have another question. How do I configure my system to use the "java" that came with 1.5,? I have no idea.
also if u have both the paths, for the 1.5 and 1.4.2 in ur path variable, the path that is specified first (from left to right ofcourse) would be take. eg: path=~/1.5/bin;~/1.4.2/bin; would use your 1.5 version every time you execute java command
Joined: Mar 07, 2006
Finally it worked! thanks a lot
I had jdk1.5 only in the path but before that there was a oracle path with 1.4.2 and may it was going there and picking that one,when I moved the jdk1.5 to in the beginning it worked fine.