Resolving the “Unsupported major.minor version 49.0” Error

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.

26 thoughts on “Resolving the “Unsupported major.minor version 49.0” Error

  1. 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

  2. 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

  3. Hi I was facing this error
    javax.servlet.ServletException: org/apache/jsp/instance_005fconstants_jsp (Unsupported major.minor version 49.0)

    in application after doing that is descrive it really help me

  4. i also got this error but only in one computer wherein the program will be used. in four other computers, it works perfectly! the weird thing is, all four computers were installed using the same Java executables. It’s really just that one computer..

  5. i also got this error but only in one computer wherein the program will be used. in three other computers, it works perfectly! the weird thing is, all four computers were installed using the same Java executables. It’s really just that one computer..

  6. Thanks, this also worked for me. It would be extreamly helpful if the error message was more descriptive.

    Again, thanks for the solution.

  7. Type this on command prompt:

    set path=”C:\Program Files\Java\jdk1.6.0_07\bin”

    This if you don’t wanna change your environment variable and restart your computer

    (Notice: You should match your JRE path)

    It works for me, Thanks for this resolve tips…

  8. i following the steps & I still get the same error. I checked my java version is 1.5.0_12 & The compile conplain leverl in Eclipse is 5.0.

  9. Oh, it’s a help for children))) Try to find libs for your programm and download it to your project – thats a help.

  10. This is an old post, but I also wanted to say thanks. While deploying updated software to a production server, I was getting a similar error. I had forgotten that part of the update required a newer version of JDK.

  11. I am using jdk1.6.2 and my java card sdk is 1.4 when compiling applet program it compiled but when converting the opt file am getting unsupported class version 50.0 please give me a solution for this??????????

  12. I have set everything to 1.4 but getting the same error can anyone assist me.

    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

    java.lang.UnsupportedClassVersionError: XXXXX/xx/xx//xx (Unsupported major.minor version 49.0)

Leave a Reply

Your email address will not be published. Required fields are marked *