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

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
🌐
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())) Ready to get started? Head over to Downloads.
🌐
PyPI
pypi.org › project › java-access-bridge-wrapper
java-access-bridge-wrapper · PyPI
Details for the file java_access_bridge_wrapper-2.0.0-py3-none-any.whl. Download URL: java_access_bridge_wrapper-2.0.0-py3-none-any.whl
      » pip install java-access-bridge-wrapper
    
Published   Nov 23, 2025
Version   2.0.0
🌐
GitHub
github.com › LeeKamentsky › python-javabridge
GitHub - LeeKamentsky/python-javabridge: Python wrapper for the Java Native Interface
GitHub repository: https://github.com/CellProfiler/python-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%
🌐
GitHub
gist.github.com › ryanrichholt › f053a0277549967444d96126722458db
Python wrapper script for launching Java jar files · GitHub
Download ZIP · 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.
🌐
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
As I stated before, it’s a matter of how to call Java implementation from python. After some consideration, I choose py4j for its simple usage. Okay, as a rule of thumb, I always create a new virtual environment for any python project. Let say we are in a new folder named tokenizer. To create a virtual environment, standing in tokenizer, you should type in the terminal like this. ... As always, install a python package is a piece of cake. ... And yes, because I’m writing a wrapper for VnCoreNLP, I can’t miss it.
🌐
GitHub
github.com › caesar0301 › pyDetectRight
GitHub - caesar0301/pyDetectRight: A Python wrapper for DetectRight Java API. DetectRight is a tool to extract information from User Agent string. This wrapper is based on Py4J to communicate with official Java library. For native Java API, please visit http://detectright.com/ · GitHub
Before using this library, you need to download the detectright database from official website. This database is about 100MB. The detectright.jar file published along with this library is an evalution version, so some methods may be out of function ...
Author   caesar0301
Find elsewhere
🌐
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...
🌐
PyPI
pypi.org › project › javabridge
javabridge · PyPI
The python-javabridge package makes it easy to start a Java virtual machine (JVM) from Python and interact with it. Python code can interact with the JVM using a low-level API or a more convenient high-level API.
      » pip install javabridge
    
Published   May 26, 2020
Version   1.0.19
🌐
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.
🌐
Fracpete
fracpete.github.io › python-weka-wrapper3 › install.html
Installation — python-weka-wrapper3 0.3.2 documentation
. ./pww3/bin/activate pip install setuptools wheel pip install python-weka-wrapper3[plots,graphs] ... Older Debian versions used python3-imaging instead of python3-pil. Download a JDK and un-tar it in /opt (e.g., /opt/jdk-11.0.23+9/). Exit superuser mode and become a regular user again.
🌐
PyPI
pypi.org › project › py4jps
py4jps · PyPI
Py4jps is a thin Python wrapper for the TheWorldAvatar project. The code is heavily based on the py4j package, which enables Python programs running in a Python interpreter to dynamically access Java objects in a Java Virtual Machine. You need Python >=3.5 to run the py4jps. You can install Python by going to the official Python download page
      » pip install py4jps
    
🌐
Huihoo
docs.huihoo.com › homepage › dkuhlman › generate_wrappers.html
Python/Java Wrapper Generator - Huihoo
This document describes generate_wrappers.py: a python script that generates files for Python wrappers for Java a class.
🌐
GitHub
github.com › thouis › Python-Java-Bridge
GitHub - thouis/Python-Java-Bridge: python wrapper for the Java Native Interface
python wrapper for the Java Native Interface. Contribute to thouis/Python-Java-Bridge development by creating an account on GitHub.
Author   thouis
🌐
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%
🌐
Baeldung
baeldung.com › home › java › how to call python from java
How to Call Python From Java | Baeldung
August 27, 2025 - Python is an increasingly popular programming language, particularly in the scientific community due to its rich variety of numerical and statistical packages. Therefore, it’s not an uncommon requirement to be able to invoke Python code from our Java applications.
🌐
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 the Java VM and the Python VM as much.
🌐
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 - agrias/javapy
Author   agrias
🌐
pytz
pythonhosted.org › javabridge › highlevel.html
High-level API — python-javabridge 1.0.12 documentation
The high-level API can wrap a Java object or class so that its methods and fields can be referenced by dot syntax.