Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I translate efficiently a Java code to python? [closed]

Tags:

python

I would be greatfull if you could tell me how one can translate a code from Java to python.
Should one do it manually ? is there any tool to convert it automatically?

like image 534
nik Avatar asked Jul 05 '16 12:07

nik


People also ask

Can I translate Java to Python?

Converting code from Java to Python is made possible, however, by a utility that will automatically convert much of Java to Python. By using this application, you can save massive amounts of time using the Java wheel in a Python program.

Can you translate one coding language to another?

Yes, it is possible to translate programming languages. You can convert the source code from one language into a code in a different language. Interpreting a programming language, however, is unnecessary and not possible at present.

What is the easiest way to convert source code from one programming language to another?

Compilers convert one programming language into another. Usually, compilers are used to convert code so the machine can understand it. If we want it to be human-readable, we need a subset of compilers called transpilers. Transpilers also convert code however the output is generally understandable by a human.


1 Answers

If you want to translate java code to python you have to translate it manually. Automatic conversion generally does not have the appropriate quality. It looks like there are some tools out e.g. java2python but the author states

The generated Python code is not guaranteed to run, nor is guaranteed to be syntactically valid Python.

Converting a library to another programming language is never an easy task.

If you simply want to use a java library in a application that you want to write in python you could give jython a try.

like image 148
syntonym Avatar answered Oct 21 '22 07:10

syntonym