We help IT Professionals succeed at work.

Easy Python to Java converter/translator

CarlosScheidecker
on
Hi all,

Is there any easy Python to Java converter / translator out there?

Something that I can do via command line or within Eclipse.

Thanks.
Comment
Watch Question

Awarded 2011
Awarded 2011

Commented:
Awarded 2011
Awarded 2011

Commented:
It does not look like there is an easy way of doing it.
Opposite direction is more doable.

But think, maybe you can rather use them intercating with each other
rather than converting Python to java

Author

Commented:
I cannot use the Python code, simple.

Hence, using Jython in Python code would produce JVM byte code? If so, then I can reverse bytecode to Java source.

What would be a way to learn how to convert Python to Java byte code via Jython?

Thanks.
It seems to me that this can do the trick:

http://www.jython.org/archive/21/docs/jythonc.html

Awarded 2011
Awarded 2011

Commented:
Yes, that seesm to be what you may want - it will compile to java methods and classes. Do you need to recompile them back?
Probably better to avoid it.

Author

Commented:
Well, they say that it will generate the source too.
Awarded 2011
Awarded 2011

Commented:
well, give it a try.
I kind of expect there may be some difficulties, but maybe you'll be lucky and it will go smoothly.
Awarded 2011
Awarded 2011

Commented:

You see  - that was older Jython site http://www.jython.org/archive/21/docs/jythonc.html

Now,
on the newer jython site they are writing:
http://wiki.python.org/jython/JythonFaq/ProgrammingJython

jythonc
jythonc is no longer available as of 2.5.

for more info on jythonc see http://www.jython.org/Project/jythonc.html 

If you follow this link - they say that
they abandoned generation of the Java source
in Jython.

So I guess you can try to use that old Jythonc, and maybe it will
be fine with your code.
But I guess they did have some reasons why the abandoned
generation of Java code from Jython.


Author

Commented:
I was able to find my own solution. Thanks.