getting UnsupportedClassVersionError

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mayur1234
    New Member
    • Mar 2007
    • 15

    getting UnsupportedClassVersionError

    hi all,
    i have installed java SDK on windows OS yesterday.
    now i am trying to run a simple program even with just one class and one method i am getting error
    java.lang.Unsup portedClassVers ionError: Bad version number in .class file
    at java.lang.Class Loader.DefineCl ass1<Native Method>
    .....

    can anybody tell me why i am getting this error???
    and how to solve it??
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    Originally posted by Mayur1234
    hi all,
    i have installed java SDK on windows OS yesterday.
    now i am trying to run a simple program even with just one class and one method i am getting error
    java.lang.Unsup portedClassVers ionError: Bad version number in .class file
    at java.lang.Class Loader.DefineCl ass1<Native Method>
    .....

    can anybody tell me why i am getting this error???
    and how to solve it??
    I have had this happen when I compiled a program with a later version of the JDK than the one I am are running with, e.g. compiled the java program with JDK 1.6 and try to run on a machine with jdk 1.5. Recompiling the java programs on the target machine tended to fix the problem.

    Comment

    • Mayur1234
      New Member
      • Mar 2007
      • 15

      #3
      Originally posted by horace1
      I have had this happen when I compiled a program with a later version of the JDK than the one I am are running with, e.g. compiled the java program with JDK 1.6 and try to run on a machine with jdk 1.5. Recompiling the java programs on the target machine tended to fix the problem.

      first of all thanks for the reply.
      but can you elaborate on the solution
      see what has happened is i had installed JRE much earlier almost a month ago for running some web applications.
      and yesterday i just installed java sdk after downloading from sun site.
      now, can you tell me what should i do to solve the problem.
      actually this is my first java installation..
      till now i was using my friends machine

      thanks in advance

      Comment

      • horace1
        Recognized Expert Top Contributor
        • Nov 2006
        • 1510

        #4
        Originally posted by Mayur1234
        first of all thanks for the reply.
        but can you elaborate on the solution
        see what has happened is i had installed JRE much earlier almost a month ago for running some web applications.
        and yesterday i just installed java sdk after downloading from sun site.
        now, can you tell me what should i do to solve the problem.
        actually this is my first java installation..
        till now i was using my friends machine

        thanks in advance
        I think you are probably trying to run the SDK with an older version of the JRE
        try downloading and installing the lastest JDK from
        http://java.sun.com/javase/downloads/index.jsp

        Comment

        • Mayur1234
          New Member
          • Mar 2007
          • 15

          #5
          Originally posted by horace1
          I think you are probably trying to run the SDK with an older version of the JRE
          try downloading and installing the lastest JDK from
          http://java.sun.com/javase/downloads/index.jsp
          thanks friend.
          it worked.
          thank you very much

          Comment

          • horace1
            Recognized Expert Top Contributor
            • Nov 2006
            • 1510

            #6
            Originally posted by Mayur1234
            thanks friend.
            it worked.
            thank you very much
            no problem, good to hear it worked!

            Comment

            Working...