Wednesday, February 9, 2011

Jython - Simple Setup and Example

Jython ( is a Python for Java project. It is useful for people who want to run Python code in JVM.

Here is to teach you some simple set up.

1. Make sure you download latest Jython at When I post this, the latest version is 2.5.3.RC3

2. The 2 most important file in the download is jython.jar and the Lib folder. jython.jar only provide a small implementation of Python functions, see Thus, you have to include the provided Lib folder. As long as the Lib folder exist along jython.jar, you can import the provided Python libraries. For example, "from re import *" to import Python regular expression library.

3. Write your own Python code with .py extension

4. Then, you can run this Python code with Java by calling

java -cp "jython.jar" org.python.util.jython

No comments:

Post a Comment

Windows 7 - STOP 0x0000007B (0xFFFFF880009A97E8 0xFFFFFFFFC0000034 0x0000000000 0x0000000000)

If you encounter STOP 0x0000007B (0xFFFFF880009A97E8 0xFFFFFFFFC0000034 0x0000000000 0x0000000000) blue screen of death. This is very like...