Brian Zhou | 16 Oct 07:12 2007

jython 2.2.1 running on phoneme-advanced (J2ME CVM)

Hi all,

I've just tested jython 2.2.1 release on both an arm little endian
linux and an arm big endian linux box with J2ME Sun's CVM.

jython-2.2.1$ cvm -cp jython.jar org.python.util.jython
Jython 2.2.1 on javaphoneme_advanced_mr2-b34
Type "copyright", "credits" or "license" for more information.
*sys-package-mgr*: processing new jar,
*sys-package-mgr*: processing new jar,
>>> import java
>>> props = java.lang.System.getProperties()
>>> props
java.vm.version=phoneme_advanced_mr2-b34, java.vm.vendor=Sun
Microsystems Inc., java.vendor.url=,
path.separator=:,,, Virtual Machine Specification,
user.dir=/share/home/bzhou/test/java/jython-2.2.1, os.arch=armv5tejl,
microedition.encoding=ISO-8859-1,, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc.,
microedition.profiles=, java.awt.fonts=,,,
microedition.platform=j2me, Profile
Specification, java.class.version=47.0, sun.misc.product=phoneME
Advanced, os.version=, user.home=/home/bzhou,
user.timezone=, file.encoding=ISO8859_1,
java.specification.version=1.1, java.class.path=jython.jar,, java.vm.specification.version=1.0,
java.home=/opt/lib/java/phoneme-advanced, user.language=en,
java.specification.vendor=Sun Microsystems Inc.,
mode, java.version=phoneme_advanced_mr2-b34, java.ext.dirs=,
java.library.builtin.math=yes, microedition.commports=/dev/ttyS0,
java.vendor=Sun Microsystems Inc., file.separator=/,
microedition.configuration=CLDC-1.1,, sun.cpu.endian=little,
user.region=US, sun.cpu.isalist=}

It runs! Good job, the Jython team!

$ cvm -cp jython.jar org.python.util.jython Lib/test/
Pystone(1.1) time for 10000 passes = 20.986
This machine benchmarks at 476.508 pystones/second

The only change I need to make is:
Index: src/org/python/core/
--- src/org/python/core/   (revision 3607)
+++ src/org/python/core/   (working copy)
 <at>  <at>  -2027,10 +2027,7  <at>  <at> 
      *         the low-order bits of its corresponding char.
     public static byte[] to_bytes(String s) {
-        int len = s.length();
-        byte[] b = new byte[len];
-        s.getBytes(0, len, b, 0);
-        return b;
+        return s.getBytes();


This is needed because CVM does not have the deprecated getBytes(int
srcBegin, int srcEnd, byte[] dst, int dstBegin) method.

It is really low hanging fruit for Jython, IMO this change alone is
worth a 2.2.2 release.. With some more testing, this potentially can
get jython to all devices that runs CVM. The test devices I'm using,
for instance, are consumer NAS devices like MSS II (Maxtor Shared
Storage II) [1], Buffalo Linkstation Pro, and Linksys NSLU2, with
optware [2] cross compiled ipkg of phoneme-advanced [3]. I know
phoneme-advanced CVM also runs on mipsel and powerpc linux routers,
phones. I can package jython as ipk for all available optware feeds


-Brian Zhou
bzhou <at>


This email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>