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
🌐
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...
Discussions

Python wrapper and interfaces/types/
Hi there 🙂 I’m trying to adapt my code (previously only using Java) in python using the Orekit Python wrapper (thanks a lot to those who developed it), it works well but I have some trouble for adapting some specidif parts of the code. For example, in Java, we can have the following method ... More on forum.orekit.org
🌐 forum.orekit.org
0
0
February 11, 2020
Adding java classes to Orekit python wrapper as a second Python extension
Hi, I have been using Orekit for a while, and for a new project I decided to try using the Python wrapper. Due to one of the requirements being that the code must be reasonably optimized, I had to write some java classes to be used as FixedStepHandlers so the code doesn’t have to switch between ... More on forum.orekit.org
🌐 forum.orekit.org
0
0
January 8, 2023
Best way to combine Python and Java?
I've used JPype for a while. It also starts a JVM from python. Once set up, interoperating with Java is transparent. You can start the JVM in such a way that it can be debugged directly using remote debugging tools. More on reddit.com
🌐 r/java
82
60
October 29, 2022
Python wrapper for Java

Is there a handle for interfacing?

More on reddit.com
🌐 r/ProgrammerHumor
46
2965
December 29, 2019
🌐
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.
🌐
Huihoo
docs.huihoo.com › homepage › dkuhlman › generate_wrappers.html
Python/Java Wrapper Generator - Huihoo
Write adapter classes, methods, and functions that use the CNI (the Compiled Native Interface) API to talk to your Java class. Use SWIG to create Python wrappers for your adapter classes, methods, and functions.
🌐
pytz
pythonhosted.org › javabridge › highlevel.html
High-level API — python-javabridge 1.0.12 documentation
Example: >>> class Integer: new_fn = javabridge.make_new("java/lang/Integer", "(I)V") def __init__(self, i): self.new_fn(i) intValue = javabridge.make_method("intValue", "()I", "Retrieve the integer value") >>> i = Integer(435) >>> i.intValue() 435 · The collection wrappers take a Java object that implements some interface and return a corresponding Python object that wraps the interface’s methods and in addition provide Python-style access to the Java object.
🌐
Py4j
py4j.org
Welcome to Py4J — Py4J
This is the Java program that was executing at the same time (no code was generated and no tool was required to run these programs). The AdditionApplication app instance is the gateway.entry_point in the previous code snippet. Note that the Java program must be started before executing the Python code above.
🌐
GitHub
github.com › LeeKamentsky › python-javabridge
GitHub - LeeKamentsky/python-javabridge: Python wrapper for the Java Native Interface
PyPI record: https://pypi.python.org/pypi/javabridge
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%
Find elsewhere
🌐
Baeldung
baeldung.com › home › java › how to call python from java
How to Call Python From Java | Baeldung
August 27, 2025 - In this tutorial, we’ll take a look at some of the most common ways of calling Python code from Java.
🌐
PyPI
pypi.org › project › java-access-bridge-wrapper
java-access-bridge-wrapper · PyPI
from JABWrapper.jab_wrapper import JavaAccessBridgeWrapper from JABWrapper.context_tree import ContextNode, ContextTree, SearchElement · The JAB creates an virtual GUI window when it is opened.
      » pip install java-access-bridge-wrapper
    
Published   Nov 23, 2025
Version   2.0.0
🌐
Jython
jython.org
Home | Jython
import org.python.util.PythonInterpreter; public class JythonHelloWorld { public static void main(String[] args) { try(PythonInterpreter pyInterp = new PythonInterpreter()) { pyInterp.exec("print('Hello Python World!')"); } } } from java.lang import System # Java import print('Running on Java version: ' + System.getProperty('java.version')) print('Unix time from Java: ' + str(System.currentTimeMillis()))
🌐
GitHub
gist.github.com › ryanrichholt › f053a0277549967444d96126722458db
Python wrapper script for launching Java jar files · GitHub
Python wrapper script for launching Java jar files · Raw · java_wrapper.py · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
🌐
Medium
medium.com › graalvm › supercharge-your-java-apps-with-python-ec5d30634d18
Supercharge Your Java Apps with Python | by Tim Felgentreff | graalvm
May 5, 2023 - If you want to learn more context about the application described in this article, GraalPy implementation, its performance, and more watch Using Python from Java with GraalVM: The template is an example Java AWT application that can render binomial functions using the PyGal Python library.
🌐
GitHub
github.com › robocorp › java-access-bridge-wrapper
GitHub - robocorp/java-access-bridge-wrapper: Python wrapper around the Java Access Bridge Windows .dll · GitHub
jab_wrapper.switch_window_by_title("Frame title") context_tree = ContextTree(jab_wrapper) Install Invoke, Poetry and the other required dependencies in order to be able to develop and package the library: pip install -Ur requirements.txt. If you want to isolate these from the other projects and not rely on the OS Python, enable a (pyenv) virtual environment first by following these instructions.
Starred by 19 users
Forked by 8 users
Languages   Python 94.9% | Java 5.0% | Batchfile 0.1%
🌐
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. This code should be considered pre-Alpha quality.
Author   thouis
🌐
Orekit
forum.orekit.org › orekit python wrapper usage
Python wrapper and interfaces/types/ - Orekit Python Wrapper usage - Orekit
February 11, 2020 - Hi there 🙂 I’m trying to adapt ... code. For example, in Java, we can have the following method : /** Add a measurement to a list if it has non-zero weight....
🌐
Medium
medium.com › geekculture › how-to-execute-python-modules-from-java-2384041a3d6d
How To Execute Python Modules From Java | by Galina Blokh | Geek Culture | Medium
July 14, 2022 - I said before the higher Python and Jep versions, the simpler syntax in Java. It is so because, in the latest Jep versions for the Python 3.9+ versions, JEP Developers added an automatic search for the Python path when you do “pip install jep”. Let's see the syntax below! Example of how to set the path for jep and create the SubInterpreter for executing python3.9
🌐
Python
wiki.python.org › moin › IntegratingPythonWithOtherLanguages
IntegratingPythonWithOtherLanguages
July 29, 2020 - 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 ·
🌐
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 - Hi, I have been using Orekit for a while, and for a new project I decided to try using the Python wrapper. Due to one of the requirements being that the code must be reasonably optimized, I had to write some java classes to be used as FixedStepHandlers so the code doesn’t have to switch between ...
🌐
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.

🌐
pytz
pythonhosted.org › javabridge › java2python.html
Calling Python from Java — python-javabridge 1.0.12 documentation
Use execute in place of exec to call Python from a javabridge CWrapper for CPython.