by 2/22/2006 10:26:00 AM 0 comments

Enabling readline support with Jython 2.2a on Mac OS X

If you do much work using Java, you're eventually going to try a scripting language that runs on the JVM. My personal favorite is Jython. The only problem is that Jython doesn't have readline support right out of the box. This makes command line usage very frustrating since all the shortcuts that command line users love are missing. Fortunatly, it's relatively easy to enable readline support. Here's the steps for setting jython up with it on Mac OS X:

  1. Install Fink
  2. Use fink to install 'readline-java'
  3. Edit the Jython registry file. Normally, this is located in the same directory that the jython.jar file is in. In case you're wondering, it's named 'registry'. You'll want to add the following lines:
    python.console=org.python.util.ReadlineConsole
    python.console.readlinelib=GnuReadline
    
  4. The last step is to add 'libJavaReadline.jnilib' to the java.library.path. An easy way to do this is to edit your script that launches Jython and add the line:
    DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/sw/lib
    
    or you can just copy libJavaReadline.jnilib and java-readline.jar to /Library/Java/Extensions

hohonuuli

Developer

Cras justo odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

0 comments: