Jython Patch for Macs

Note: Finn Bock tells me that the Mac patch is included in the upcoming Jython 2.1. I'll keep this page around, however, until Jython 2.1 is officially released (it's currently in alpha testing).

Apple's MRJ has a bug that causes trouble when running Java bytecode that was compiled from Jython sources. Specifically, the MRJ terminates with a TypeError when it attempts to assign values to bean properties such as actionPerformed or keyTyped (this problem does not occur when Jython sources are being run with the Jython interpreter).

I have reported this bug to Apple (bug ID #2656645), so there's a chance it'll be fixed in the future. For the time being, you can use a patch. The easiest way to install the patch is to replace your current jython.jar by the patched jython.jar.

If you are comfortable compiling Jython sources and rebuilding your installation of Jython, then you can replace the source file org/python/core/PyJavaClass.java by the patched PyJavaClass.java.

If you cannot patch your installation of Jython, you can download the binary file org/python/core/PyJavaClass.class and patch .jar files by typing jar uf foo.jar org/python/core/PyJavaClass.class after you've created foo.jar with jythonc --deep --core --jar foo.jar .... This is also the way to go if you want to run the precompiled demos that come with the distribution of Jython.

Finally, you can pull the patched PyJavaClass.java out of the Jython CVS repository and install it.

The patched PyJavaClass.java was downloaded from the CVS repository on March 06, 2001.

Credits

Finn Bock and I worked together to isolate the bug in Apple's MRJ after I encountered difficulties running compiled Jython code on Macs. Finn (with a little bit of input from my side) found the workaround included in the patch.


Peter Brinkmann
$Date: 2001-03-16 17:58:53-06 $

Valid HTML 4.01!