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:

  1. Check you java version by running the command java – version
  2. Check your environment variable JAVA_HOME and the path associated with it
  3. Check your server installation if it was installed on an older version
  4. 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:

  1. Edit your JAVA_HOME with the latest java home folder path
  2. Edit your path variable which might already have been set with older version
  3. For this goto My Computer > Properties > Advanced > Environment Variables > path
  4. Remove the earlier version path which might be something like <java_installed_path>/bin and replace it with newer version path
  5. 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.

Stumble Digg Technorati Subscribe Delicious