4

When I use certain jars in one of the connector projects i write for lombardi in TeamWorks eclipse i get a bad class version exception...

any ideas how this might be resolved..

Regards, Adhir

Adhir
  • 749
  • 3
  • 11
  • 20

5 Answers5

13

You will get this error if you are using (say) Java 1.5 and you are using a JAR compiled with Java 1.6.

The easiest way to resolve is to upgrade your version of Java to the one used by the JAR.

Simon Nickerson
  • 42,159
  • 20
  • 102
  • 127
  • 1
    you can recompile and set the compiler to compile it for Java 1.5 if your target machine uses that version – setzamora May 11 '09 at 11:22
  • Setting the target version doesn't check for method/classes added in the newer version. i.e. it doesn't check @since So using Java 6 you can compile code with target of 1.5, but if you have used String.getBytes(Charset) for example, you will get an error. – Peter Lawrey May 11 '09 at 20:15
  • +1. This is the onw that is experianced in most of the times. – ironwood Apr 10 '14 at 09:02
2

Try to compile/recompile all your stuff with the same compiler. Typically this happens when you have something compiled with a higher version and you try to run it with an older one.

Luixv
  • 8,590
  • 21
  • 84
  • 121
1

This problem can also be caused by an expired (365-day) Android certificate referenced by Eclipse.

See "Debug certificate expired" error in Eclipse Android plugins for details.

Community
  • 1
  • 1
Kirk A
  • 121
  • 1
  • 4
0

Root Cause for this error is that: jars including in your project is complied from other version of java and you are compiling your project from other version of java simply upgrading version of java will resolve this problem.

I also faced the same problem.

TechSunil
  • 141
  • 2
  • 1
0

This is a result of running code compiled with a compiler version that is greater than the version of java you are using to run it. IE Code compiled with 1.6 and you are running it with 1.5. See this post to determine what version it was compiled with.

how-can-i-find-the-target-java-version-for-a-compiled-class

the easiest fix is to run it with the most recent JVM.

Community
  • 1
  • 1
Mike Pone
  • 18,705
  • 13
  • 53
  • 68