2 Replies Latest reply on Apr 11, 2008 11:17 AM by ronnie8080

    Bad version number in .class

    ronnie8080

      Hello All,

      I am working on JBoss Developer Studio 1.0.0.GA. I have been able to try out the jsp demo from the website. Now I am trying to develop a simple servlet but am getting

      java.lang.UnsupportedClassVersionError: Bad version number in .class file
       at java.lang.ClassLoader.defineClass1(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)
      

      Here are my eclipse/JBDS settings

      Preferences-Java-Installed JREs - jre1.5.0_15
      Preferences-Server-Installed Runtimes - JBoss 4.2 Runtime - Edit - ...JRE - jre1.5.0_15

      My JAVA_HOME points to C:\xxx\java\jdk1.5.0_15
      My PATH var has .;C:\j2sdk1.4.2_04 in the beginning.

      I am on Windows 2000.

      Please help.
      Thank you.
      R

        • 1. Re: Bad version number in .class
          maxandersen

          Sounds like you have some compiler settings set different than your runtime.

          e.g. compiler settings set to Java5 but running with Java 1.4 would cause this.

          Look under your projects properties for compiler compliancee level.

          • 2. Re: Bad version number in .class
            ronnie8080

            Hi Max,

            Thank you for the reply and pointing me in the correct direction.

            I checked my compiler settings as you suggested and confirmed that everything there was indeed pointing to 5.0. After that I also tried changing Project Facets - Java - to 5.0 from 6.0 and that helped.

            Thanks again.
            R