Actually, this may or may not be much help but you could write a script which created a Java class for each Python class, including method stubs, placing the Python implementation of the method inside the Javadoc

In fact, this is probably pretty easy to knock up in Python.

I worked for a company which undertook a port to Java of a huge Smalltalk (similar-ish to Python) system and this is exactly what they did. Filling in the methods was manual but invaluable, because it got you to really think about what was going on. I doubt that a brute-force method would result in nice code.

Here's another possibility: can you convert your Python to Jython more easily? Jython is just Python for the JVM. It may be possible to use a Java decompiler (e.g. JAD) to then convert the bytecode back into Java code (or you may just wish to run on a JVM). I'm not sure about this however, perhaps someone else would have a better idea.

Answer from oxbow_lakes on Stack Overflow
🌐
GitHub
github.com › chrishumphreys › p2j
GitHub - chrishumphreys/p2j: Python to Java translator · GitHub
Python to Java translator. Contribute to chrishumphreys/p2j development by creating an account on GitHub.
Starred by 120 users
Forked by 58 users
Languages   Python
🌐
GitHub
github.com › JanX2 › p2j
GitHub - JanX2/p2j: Python to Java translator
Python to Java translator. Contribute to JanX2/p2j development by creating an account on GitHub.
Author   JanX2
🌐
GitHub
github.com › sdziallas › softsys-p2j
GitHub - sdziallas/softsys-p2j: Python to Java Translator for Olin's Software Systems Course
Description: Python to Java Translator for Olin College's Software Systems course.
Author   sdziallas
🌐
GitHub
github.com › chrishumphreys › p2j › blob › master › README.md
p2j/README.md at master · chrishumphreys/p2j
Python to Java translator. Contribute to chrishumphreys/p2j development by creating an account on GitHub.
Author   chrishumphreys
🌐
Goucher
phoenix.goucher.edu › ~kelliher › f2019 › cs205 › lab0P2J.pdf pdf
Lab 0 P2J: From Python to Java
Hello! I'm an associate professor of Mathematics and Computer Science in the Center for Data, Mathematical, and Computational Sciences at Goucher College in the big city of Baltimore, MD. Before arriving here, I taught at Westminster College in the small town of New Wilmington, PA.
🌐
DaniWeb
daniweb.com › programming › software-development › threads › 507349 › p2j
p2j - python - DaniWeb
January 28, 2017 - I need to convert python code to java, can anyone help me - Topic in the Software Development forum contributed by Arpita_1
🌐
Parkers Legacy
parkerslegacy.com › can-you-convert-python-to-java
Can you convert Python to Java? - Parkers Legacy
July 14, 2021 - Can you convert Python to Java: There is a translator called P2J that can convert a subset of Python into Java. My universal-transpiler project...
🌐
GitHub
github.com › chrishumphreys › p2j › commit › 9c1640925b0b7c0f4a50151f55b4c62d66b1fc07
Initial import · chrishumphreys/p2j@9c16409
April 7, 2011 - Python to Java translator. Contribute to chrishumphreys/p2j development by creating an account on GitHub.
Author   chrishumphreys
Find elsewhere
🌐
PyPI
pypi.org › project › p2j
p2j · PyPI
Here's another example of a Python source code and its Jupyter notebook after converting. The purpose of this package is to be able to run a code on Jupyter notebook without having to copy each paragraph of the code into every cell. It's also useful if we want to run our code in Google Colab. This parser isn't perfect, but you would be satisfactorily pleased with what you get. ... Specify the target filename with a -t. p2j <(curl https://raw.githubusercontent.com/keras-team/keras/master/examples/mnist_cnn.py) -t myfile.ipynb
      » pip install p2j
    
Published   Nov 17, 2019
Version   1.3.2
🌐
Python
mail.python.org › pipermail › pydotorg-www › 2016-April › 003528.html
[pydotorg-www] Converting Python code to java code/bytecode
April 30, 2016 - They have a new page on github: ... > 1) http://pybee.org/voc/ - Converts python to java byetcode > 2) https://www.py4j.org/index.html - Allows python code to access jvm > objects. > 3) https://github.com/chrishumphreys/p2j - An old python to java > translator....
🌐
Quora
quora.com › What-is-the-best-way-to-convert-Python-to-Java-assuming-that-performance-speed-and-code-readability-are-not-an-issue
What is the best way to convert Python to Java, assuming that performance, speed, and code readability are not an issue? - Quora
Answer (1 of 12): The fastest I have seen is by using a Tokenizer I will explain. #A Python Script… Delimiters in Python are how it is compiled to and for C to execute. We do this all the time with Java also. Computer languages are very similar and use Tokenisers just as you can see here below ...
🌐
YouTube
youtube.com › watch
From Python to Java: Converting a Simple Program - YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
Published   January 18, 2018
🌐
GitHub
github.com › fmount › Py2J
GitHub - fmount/Py2J: A translator from Python to Java
A translator from Python to Java. Contribute to fmount/Py2J development by creating an account on GitHub.
Forked by 2 users
Languages   Java 98.2% | Java 98.2%
🌐
Javainuse
javainuse.com › py2java
Online Python to Java Converter Tool
Please add javainuse.com to your ad blocking whitelist or disable your adblocking software. × · Online tool to convert Python source code into Java.
🌐
Reddit
reddit.com › r/jupyternotebooks › python script to jupyter notebook
r/JupyterNotebooks on Reddit: Python script to Jupyter notebook
July 3, 2019 - Just published a Python package on PyPI called p2j. Run pip install p2j and p2j script.py to get a Jupyter notebook script.ipynb. Example shown…
🌐
PyPI
pypi.org › project › p2j › 1.1.0
p2j
March 6, 2019 - JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser