java.lang.UnsupportedClassVersionError: Bad version number in .class file

Symptoms:

When call a shared library, a java.lang.UnsupportedClassVersionError: Bad version number in .class file exception occurs.

Cause:

A compile-time/run-time mismatch in the versions of Java.

The library was compiled for Java1.6; however, it was running with Java1.5.

Solution:

In the Ant build file, specify the version of source and target in the javac task to match the run-time Java version.

For example:

<javac … source=”1.5″ target=”1.5″/>

 

Reference: http://ant.apache.org/manual/Tasks/javac.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s