Written by nitinpai on October 10th, 2007
Resolving the “Unsupported major.minor version 49.0″ Error
Issues, Java, Java EE
4 responses
Many a times I have come across my friends who get this error and are clueless because this error is not something related to the programming logic neither to the server which shows this error either on accessing a servlet or a service. You have to know that this error comes when a class compiled on a newer version is being tried to run on an older JVM i.e. If you try to run a JDK 1.5 compiled class in an environment having JRE 1.4 the JRE will give you the error,
Unsupported major.minor version 49.0
This error is given because the new features introduced in the newer version of Java are not present in the older version. So you have to be careful for using such class files on older environments. For resolving this error you have to follow some simple tips as follows:
- Check you java version by running the command java - version
- Check your environment variable JAVA_HOME and the path associated with it
- Check your server installation if it was installed on an older version
- Check which path exists in the environment entries
These are the quick tips you would need to do in order to get rid of the error. Sometimes it may happen that the system which you are using might be loaded with 2 to 3 version of Java and you might be required to work on the newer one. In such cases always there is a confusion as to what went wrong and with which version. So if you are left in such crises do the following quick action tips:
- Edit your JAVA_HOME with the latest java home folder path
- Edit your path variable which might already have been set with older version
- For this goto My Computer > Properties > Advanced > Environment Variables > path
- Remove the earlier version path which might be something like <java_installed_path>/bin and replace it with newer version path
- If your server was installed on a older version of Java and if it not been used then its better to uninstall it and then install it after making the above changes.
Note: You can check if your server was installed on an older version or not by opening the startup.bat of your Tomcat server or any start up script of other servers and finding the part where the script itself sets the JAVA_HOME variable. If you find that it has been set to a older version then it won’t do any good just by replacing it with a newer version path. You would ultimately have to reinstall the server as per my understanding.
It would be interesting to know if the same can be resolved without having to reinstall the server. Please suggest some alternatives if you have.
4 Responses
Wednesday, February 13, 2008
Thanks. Saved me a lot of time.
Monday, March 10, 2008
I had similar issue with RAD7.x and found that irrespective of what is set in JAVA_HOME , you have to do the following things too
1. Right click on your webproject > Properties > Project Facets > Set Java version 1.4
2. Select Java compiler (in same window) > Select the “JDK Compliance” to 1.4
3. Last, select Windows preference in RAD > Java > Installed JREs > Ensure its set to JDK 1.4
Thanks Nitin !
Aruna
Wednesday, March 19, 2008
Thank you. I spent half a day trying to figure this one out.
Wednesday, April 23, 2008
I am still getting the same error. I installed jre1.6 and also jdk 1.6 and i checked with java -version and it is showing that i am having jre1.6. However I am still getting this error. Please advice.
[Analyzing Version 2] java.lang.UnsupportedClassVersionError: jdiff/JDiff (Unsupported major.minor version 49.0)
[Analyzing Version 2] at java.lang.ClassLoader.defineClass0(Native Method)
[Analyzing Version 2] at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
[Analyzing Version 2] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
[Analyzing Version 2] at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
[Analyzing Version 2] at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
[Analyzing Version 2] at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
[Analyzing Version 2] at java.security.AccessController.doPrivileged(Native Method)
[Analyzing Version 2] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
[Analyzing Version 2] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
[Analyzing Version 2] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[Analyzing Version 2] at com.sun.tools.javadoc.DocletInvoker.(DocletInvoker.java:69)
[Analyzing Version 2] at com.sun.tools.javadoc.Start.setDocletInvoker(Start.java:343)
[Analyzing Version 2] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:170)
[Analyzing Version 2] at com.sun.tools.javadoc.Start.begin(Start.java:121)
[Analyzing Version 2] at com.sun.tools.javadoc.Main.execute(Main.java:41)
[Analyzing Version 2] at com.sun.tools.javadoc.Main.main(Main.java:31)
[Analyzing Version 2] javadoc: fatal error