Major version 50 means that the classes were compiled with Java 6.

Which java version 5 cannot run.

You have to either

A: Run your code on jython with version 6
B: Compile jython with java 5, if you want to run it with java 5.

Did you compile jython yourself?


On Sun, Jun 2, 2013 at 3:52 PM, M.Rule <> wrote:
Hi, I have a Jython app that uses one pure Java class Foo. Calling import Foo in Jython leads to the "java.lang.UnsupportedClassVersionError: java.lang.UnsupportedClassVersionError: Bad version number in .class file" error ( no other info provided ) on OSX but not on linux. 

As far as I can tell, the class version matches the Jython runtime version:

# asking for version number from jython
$ jython -v
Jython 2.5.3b1 (2.5:5fa0a5810b25, Feb 22 2012, 12:39:02) 
[Java HotSpot(TM) Client VM (Apple Inc.)] on java1.5.0_30

# inspecting version number at runtime from within jythong
>>> import java.lang.System as System 
>>> System.getProperty('java.version')

# system java version
$ java -version
java version "1.5.0_30"

# system javac version
$ javac -version
javac 1.5.0_30

# inspecting compiled class ( this means 1.5 if I understand correctly )
$ javap -v Foo | grep version
  minor version: 0
  major version: 50

I'm not sure I can fix this on my own, since everything I know to check checks out. Maybe it is a bug? Have other people encountered this?

Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
Jython-users mailing list