FAQ
java2python - Java to Python Source Code Translator
---------------------------------------------------
java2python 0.2 Released 18 February 2007


What is java2python?
------------------------------------------------------------------------------
java2python is a simple but effective tool to translate Java source code into
Python source code. It's not perfect, and does not aspire to be.


What's new in this release?
------------------------------------------------------------------------------
Small enhancement: added converstion of "public static void main" method into
module "if __name__ == '__main__' block.

Better classmethod support: fixed class/instance member formatting strings to
account for classmethods.

Slightly more pythonic: replace "x == None" expressions with "x is None" in
output code, also replace "x != None" with "x is not None".

Bugfix: Fixed dotted type identifiers.

Better exception translation: added support for mapping java exception types
to python exception types.

Support for non-local base class members: added support for base class
members via config modules.

Bugfix: changed single % characters to %% in expression format strings.

Small enhancement: added support for 'methodPreambleSorter' configuration
item. With this value, config modules can specify how to sort method
preambles (typically decorators).


Where can I get java2python?
------------------------------------------------------------------------------
java2python is available for download from Google code:

http://code.google.com/p/java2python/downloads/list

Project page:

http://code.google.com/p/java2python/


How do I use java2python?
------------------------------------------------------------------------------
Like this:

$ j2py -i input_file.java -o output_file.py

The command has many options, and supports customization via multiple
configuration modules.


What are the requirements?
------------------------------------------------------------------------------
java2python requires Python 2.5 or newer. Previous versions may or may not
work. java2python requires ANTLR and PyANTLR to translate code, but
translated code does not require ANTLR.


What else?
------------------------------------------------------------------------------
java2python is installed with distutils. Refer to the Python distutils
documentation for more information. The digest version is:

$ tar xzf java2python-0.2.tar.gz
$ cd java2python-0.2
$ python setup.py install

java2python is licensed under the GNU General Public License 2.0. No license
is assumed of (or applied to) translated source.

I'm very interested in your experience with java2python. Please drop me an
note with any feedback you have.

Troy Melhase
mailto:troy at gci.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-list/attachments/20070218/10256627/attachment.pgp

Search Discussions

  • Kay Schluehr at Feb 19, 2007 at 9:22 am

    On 19 Feb., 15:38, Troy Melhase wrote:
    java2python - Java to Python Source Code Translator
    ---------------------------------------------------
    java2python 0.2 Released 18 February 2007

    What is java2python?
    ------------------------------------------------------------------------------
    java2python is a simple but effective tool to translate Java source code into
    Python source code. It's not perfect, and does not aspire to be.

    What's new in this release?
    ------------------------------------------------------------------------------
    Small enhancement: added converstion of "public static void main" method into
    module "if __name__ == '__main__' block.

    Better classmethod support: fixed class/instance member formatting strings to
    account for classmethods.

    Slightly more pythonic: replace "x == None" expressions with "x is None" in
    output code, also replace "x != None" with "x is not None".

    Bugfix: Fixed dotted type identifiers.

    Better exception translation: added support for mapping java exception types
    to python exception types.

    Support for non-local base class members: added support for base class
    members via config modules.

    Bugfix: changed single % characters to %% in expression format strings.

    Small enhancement: added support for 'methodPreambleSorter' configuration
    item. With this value, config modules can specify how to sort method
    preambles (typically decorators).

    Where can I get java2python?
    ------------------------------------------------------------------------------
    java2python is available for download from Google code:

    http://code.google.com/p/java2python/downloads/list

    Project page:

    http://code.google.com/p/java2python/

    How do I use java2python?
    ------------------------------------------------------------------------------
    Like this:

    $ j2py -i input_file.java -o output_file.py

    The command has many options, and supports customization via multiple
    configuration modules.

    What are the requirements?
    ------------------------------------------------------------------------------
    java2python requires Python 2.5 or newer. Previous versions may or may not
    work. java2python requires ANTLR and PyANTLR to translate code, but
    translated code does not require ANTLR.

    What else?
    ------------------------------------------------------------------------------
    java2python is installed with distutils. Refer to the Python distutils
    documentation for more information. The digest version is:

    $ tar xzf java2python-0.2.tar.gz
    $ cd java2python-0.2
    $ python setup.py install

    java2python is licensed under the GNU General Public License 2.0. No license
    is assumed of (or applied to) translated source.

    I'm very interested in your experience with java2python. Please drop me an
    note with any feedback you have.

    Troy Melhase
    mailto:t... at gci.net

    application_pgp-signature_part
    1KHerunterladen

    Hi Troy. What is the rationale for your project?
  • Troy Melhase at Feb 19, 2007 at 12:49 pm
    Hi Troy. What is the rationale for your project?
    Hi Kay,

    I maintain a python port of a java library. It finally got too
    complicated to do by hand, so I wrote java2python to make my life
    easier. I wrote more extensively about the library and this tool in
    my blog:

    http://blog.melhase.net/articles/2007/02/15/automated-translation-of-java-to-python

    I haven't documented the tool and all of it's configuration options in
    detail; please let me know if I can explain something further.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedFeb 19, '07 at 4:38a
activeFeb 19, '07 at 12:49p
posts3
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase