Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Simple but effective library to translate Java source code to Python.
Python GAP Java

Merge pull request #29 from iuliux/patch-1

Update ANTLR remote location
latest commit ee997c7aa7
@natural authored


Simple but effective tool to translate Java source code into Python.

The java2python package can translate any syntactically valid Java source code file. The generated Python code is not guaranteed to run, nor is guaranteed to be syntactically valid Python. However, java2python works well many cases, and in some of those, it creates perfectly usable and workable Python code.

For more information, read the introduction. To install, refer to the installation page.

There are lots of docs, plenty of tests, and many options for controlling code generation.

If you're looking for old releases, check the downloads link above.

Here's a very simple example:

$ cat
// This is the HelloWorld class with a single method.
class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, world.");

Next we run our program:

$ j2py
#!/usr/bin/env python
""" generated source for module HelloWorld """

#  This is the HelloWorld class with a single method.
class HelloWorld(object):
    """ generated source for class HelloWorld """

    def main(cls, args):
        """ generated source for method main """
        print "Hello, world."

if __name__ == '__main__':
    import sys
Something went wrong with that request. Please try again.