You could try this way:

  • Use Jython instead of CPython to write Python code http://www.jython.org.
  • Integrate Jython code with Java code through Apache Bean Scripting Framework http://commons.apache.org/bsf/

If you definitely need to use CPython, then Apache Trift could be interesting for you: http://thrift.apache.org/ So you could make additional scalable abstraction layer and integrate your Java code with different languages (not only Python)

If you need a really low-level interface you could look at JNI http://java.sun.com/docs/books/jni/ for investigation. But I think it will take a lot of time to integrate your code with CPython using JNI.

Answer from Vladislav Bauer on Stack Overflow
🌐
motmaytinh
quytran.is-a.dev › 2019 › 06 › how-i-wrote-a-python-wrapper-for-java-implementation-of-vncorenlp
How I wrote a python wrapper for Java implementation of VnCoreNLP • Tran Ngoc Quy
Create a new python file in the folder __init__, in my case I named it vncorenlp.py ... It’s the standard library that you must import if you want to call a Java instance. Now, let’s construct a class for the wrapper.
Discussions

Python wrapper for Java

Is there a handle for interfacing?

More on reddit.com
🌐 r/ProgrammerHumor
46
2965
December 29, 2019
Adding java classes to Orekit python wrapper as a second Python extension
Due to one of the requirements ... FixedStepHandlers so the code doesn’t have to switch between the Java VM and the Python VM as much. In order to use these classes in Python I originally rebuilt the whole wrapper with a similar script to the one in conda-forge but adding an extra ... More on forum.orekit.org
🌐 forum.orekit.org
0
0
January 8, 2023
Use java library from python (Python wrapper for java library) - Stack Overflow
I have a java library in jar form which can be used to extract data from files(excel,xml etc). As its in java, it can be used only in java applications. But i need the same library to be used for p... More on stackoverflow.com
🌐 stackoverflow.com
Best way to wrap Java classes into Python - Stack Overflow
I have a Java library and I have to build a Python wrapper to it. I am using py4j, and it's pretty easy to get any instance and any class, complete with method. The problem is that the type of an More on stackoverflow.com
🌐 stackoverflow.com
May 9, 2018
🌐
Quora
quora.com › What-is-a-simple-example-of-wrapping-a-Java-library-with-Python
What is a simple example of wrapping a Java library with Python? - Quora
Answer: You could try this way: Use Jython instead of CPython to write Python code www.jython.org Integrate Jython code with Java code through Apache Bean Scripting Framework commons.apache.org/bsf/ If you definitely need to use CPython, then Apache Trift could be interesting for you: Apache T...
🌐
Huihoo
docs.huihoo.com › homepage › dkuhlman › generate_wrappers.html
Python/Java Wrapper Generator - Huihoo
generate_wrappers.py generates support files that enable Python to use the classes and methods in a Java source code file.
🌐
GitHub
github.com › LeeKamentsky › python-javabridge
GitHub - LeeKamentsky/python-javabridge: Python wrapper for the Java Native Interface
Python wrapper for the Java Native Interface. Contribute to LeeKamentsky/python-javabridge development by creating an account on GitHub.
Starred by 117 users
Forked by 64 users
Languages   Python 93.1% | Cython 4.4% | C 1.5% | Python 93.1% | Cython 4.4% | C 1.5%
🌐
pytz
pythonhosted.org › javabridge › highlevel.html
High-level API — python-javabridge 1.0.12 documentation
The functions make_new and make_method create Python methods that wrap Java constructors and methods, respectively. The function can be used to create Python wrapper classes for Java classes.
🌐
Reddit
reddit.com › r/programmerhumor › python wrapper for java
r/ProgrammerHumor on Reddit: Python wrapper for Java
December 29, 2019 - SWIG isn't cross language to Python, it's cross language to C/C++. Python is one common use, but it's also used to communicate between C++ and Java, and other languages.
Find elsewhere
🌐
GitHub
github.com › thouis › Python-Java-Bridge
GitHub - thouis/Python-Java-Bridge: python wrapper for the Java Native Interface
This is a python wrapper for the Java Native Interface. It was written as part of the CellProfiler project (http://cellprofiler.org) by members of the Imaging Platform at the Broad Institute of MIT and Harvard.
Author   thouis
🌐
GitHub
github.com › agrias › javapy
GitHub - agrias/javapy: Python wrapper for Java/Scala using native libraries
July 11, 2019 - Python wrapper for Java/Scala using native libraries
Author   agrias
🌐
Orekit
forum.orekit.org › orekit python wrapper usage
Adding java classes to Orekit python wrapper as a second Python extension - Orekit Python Wrapper usage - Orekit
January 8, 2023 - Due to one of the requirements ... FixedStepHandlers so the code doesn’t have to switch between the Java VM and the Python VM as much. In order to use these classes in Python I originally rebuilt the whole wrapper with a similar script to the one in conda-forge but adding an extra ...
🌐
Python
wiki.python.org › moin › IntegratingPythonWithOtherLanguages
IntegratingPythonWithOtherLanguages
bedevere - Python wrapper to GNU Prolog http://bedevere.sourceforge.net/ pwig includes examples of wrapping Python for SWI-Prolog. pyswip is a ctypes based module that enables querying SWI-Prolog. See also http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=Python+prolog · Jython - Python implemented in Java ·
🌐
Py4j
py4j.org
Welcome to Py4J — Py4J
Py4J enables Python programs running in a Python interpreter to dynamically access Java objects in a Java Virtual Machine. Methods are called as if the Java objects resided in the Python interpreter and Java collections can be accessed through standard Python collection methods.
🌐
Stack Overflow
stackoverflow.com › questions › 50252481 › best-way-to-wrap-java-classes-into-python
Best way to wrap Java classes into Python - Stack Overflow
May 9, 2018 - Have you tried JPype? It is a very mature approach for wrapping Java classes into Python classes, as Pythonically as possible.
🌐
Baeldung
baeldung.com › home › java › how to call python from java
How to Call Python From Java | Baeldung
August 27, 2025 - As previously mentioned, we’ve made the assumption that the python command is available via the PATH variable. JSR-223, which was first introduced in Java 6, defines a set of scripting APIs that provide basic scripting functionality. These methods provide mechanisms for executing scripts and for sharing values between Java and a scripting language.
🌐
Reddit
reddit.com › r/java › best way to combine python and java?
r/java on Reddit: Best way to combine Python and Java?
October 29, 2022 -

My project uses some packages that are available only in Python and heavily rely on C libraries. The project also greatly benefits from Java libraries and the JVM. What's the optimal way to call Python functions from Java?

I tried:

  1. Small web-services: overhead to serialize data, start and stop the services. Also debugging is harder and implementing each new function is now double the effort.

  2. Jpy: a library that runs an interpreter in the JVM. Spare the service start/stop, but: isn't really feasible for more than a single-liner, data translation between Java and Python is cumbersome, and I also encountered runtime segmentation fault errors.

Any other options?

The project is in the machine-learning domain, so involves exchanging large numeric arrays and text. In some cases the execution switches back and forth between the platforms.

🌐
GitHub
github.com › robocorp › java-access-bridge-wrapper
GitHub - robocorp/java-access-bridge-wrapper: Python wrapper around the Java Access Bridge Windows .dll · GitHub
Python wrapper around the Java Access Bridge / Windows Access Bridge.
Starred by 19 users
Forked by 8 users
Languages   Python 94.9% | Java 5.0% | Batchfile 0.1%
🌐
CodingTechRoom
codingtechroom.com › question › -python-wrapper-java-library
How to Create a Python Wrapper for a Java Library - CodingTechRoom
Learn how to write a Python wrapper for a Java library using Jython and Py4J. Step-by-step instructions and best practices included.