JPype is an alternative to Jython that I made some good experience with. If it is not enough to call the java program and work with the output (it's hard to tell from your question), then JPype can be used to (more or less) transparently work with Java object in Python code.

I works by starting a JVM and handing requests to said JVM.

Answer from kutschkem on Stack Overflow
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 27489109 โ€บ call-java-class-from-a-jar-file-in-python-easily-without-another-complicated-pro
Call java class from a jar file in python easily without another complicated program like Py4j - Stack Overflow
May 24, 2017 - Alternatively, Py4j and JPype appear to be libraries designed to allow interface with Java from CPython. ... A link which is a relevant reference to topic in hand is - link. ... Sign up to request clarification or add additional context in comments. ... This example just registers the jar file to the sys path.
๐ŸŒ
Manmustbecool
manmustbecool.github.io โ€บ MyWiki โ€บ Wiki โ€บ Python โ€บ python_java.html
Call Java from Python
Run the compiled class to start the py4j gateway, java -cp /usr/local/share/py4j/py4j0.10.5.jar:. AdditionApplication ยท py4j0.10.5.jar must be used. And in windows using โ€˜;โ€™ instead of โ€˜:โ€™ (e.g. xxx/py4j0.10.5.jar;. AdditionApplication) Call the java app from python script ยท
๐ŸŒ
Data Science Learner
datasciencelearner.com โ€บ python โ€บ how-to-call-jar-file-using-python
How to Call Jar File Using Python? - Python Tutorial Data Science Learner
October 27, 2022 - This article " How to call jar file using Python " will brief you on two different ways in Python to call jar externally (os.system and subprocess.call) .
๐ŸŒ
Readthedocs
jpy.readthedocs.io โ€บ en โ€บ latest โ€บ intro.html
Introduction โ€” jpy 0.9.0 documentation
Java programs with jpy.jar on the classpath can import Python modules, access module attributes such as class types and variables, and call any callable objects such as module-level functions, class constructors, as well as static and instance class methods.
๐ŸŒ
LinuxTut
linuxtut.com โ€บ en โ€บ 9add34871a43c4181af7
[JAVA] Import classes in jar files directly from Python scripts
May 25, 2013 - Jython is a standard module and does not support SQLite, so a JDBC driver is required, If you can read the JDBC driver jar file directly from the Python script, You can use Java classes and SQLite from Python just by throwing in the files you need. import.sys sys.path.append("/path/to/hoge...
๐ŸŒ
Python Software Foundation
wiki.python.org โ€บ jython โ€บ LearningJython
Jython Course Outline - Python Wiki
You will need to describe the signature of methods in order to make them callable from Java (in addition to Jython). What jythonc does -- jythonc translates .py files into .java source code files, then compiles these to .class files. ... Compile Jython (.py) to Java class files (.class).
๐ŸŒ
Py4j
py4j.org
Welcome to Py4J โ€” Py4J
Here is a brief example of what you can do with Py4J. The following Python program creates a java.util.Random instance from a JVM and calls some of its methods. It also accesses a custom Java class, AdditionApplication to add the generated numbers.
Find elsewhere
๐ŸŒ
USAVPS
usavps.com โ€บ home โ€บ python โ€บ python tutorial: how to call jar packages in python
Python Tutorial: How to Call JAR Packages in Python - USAVPS.COM
October 22, 2024 - A JAR file that you want to call from Python. JPype or Py4J library for bridging Python and Java. JPype is a popular library that allows Python programs to access Java classes as if they were Python classes.
๐ŸŒ
Liacs
rsewiki.liacs.nl โ€บ calling_java_from_python
Calling Java from Python [LIACS Wiki]
April 1, 2021 - This approach allows direct memory access between the two machines, implementation of Java interfaces in Python, and even use of Java threading. ... # Boiler plate stuff to start the module import jpype import jpype.imports from jpype.types import * # Launch the JVM jpype.startJVM(classpath=['jars/database.jar']) # import the Java modules from com.paying.customer import Database db = Database("our_records") with db.connect() as c: c.runQuery() while c.hasRecords(): recor...
๐ŸŒ
Better Programming
betterprogramming.pub โ€บ accessing-java-classes-in-python-using-pyjnius-6122bcaad49a
Accessing Java Classes in Python Using Pyjnius | by Eldad Uzman | Better Programming
March 8, 2022 - Now, in our Python code, we should add the jar file to our Java classpath as shown below: First, we concluded where the jar file is at, then we added it to the Java classpath using jnius_config.set_classpath. Now our main section does the exact same thing our main method in Java did. It instantiated a list of integers from ...
๐ŸŒ
LinuxTut
linuxtut.com โ€บ en โ€บ e90cbbfdac439e6e9d30
An easy way to call Java from Python
October 9, 2016 - For the time being, it can be called from python. However, it is a little troublesome to start and stop the server from the terminal. Anyway, let's run it in python from start to finish. #Execute by specifying the classpath args=(["java","-cp",'/path/to/class/','AdditionApplication']) p=subprocess.Popen(args) #Prevent processing from going down before starting the server time.sleep(3) gateway = JavaGateway(start_callback_server=True) random = gateway.jvm.java.util.Random() n1 = random.nextInt(10) n2 = random.nextInt(10) print(number1,number2) # (2, 7) addition_app = gateway.entry_point print(addition_app.addition(n1, n2)) # 9 #Kill the process gateway.shutdown()
๐ŸŒ
Quora
quora.com โ€บ Is-it-possible-to-run-a-third-party-Java-library-in-Python
Is it possible to run a third-party Java library in Python? - Quora
Answer (1 of 3): Yes, by using a bridge. Py4J seems to be an up-to-date open source one: Welcome to Py4J - Py4J Got the hint from StackOverflow Calling Java from Python . Have used something similar myself also ages ago. Example: [code]>>> from py4j.java_gateway import JavaGateway # connect ...
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 34245074 โ€บ calling-jar-from-python
java - Calling JAR from Python - Stack Overflow
from subprocess import Popen, PIPE, STDOUT p = Popen(['java', '-jar', 'action.jar'], stdin=PIPE, stdout=PIPE, stderr=STDOUT) stdout1, stderr1 = p.communicate(input=sample_input1) print "Result is", stdout1 p = Popen(['java', '-jar', 'action.jar'], stdin=PIPE, stdout=PIPE, stderr=STDOUT) stdout2, stderr2 = p.communicate(input=sample_input2) print "Result is", stdout2 ยท Loading the jar takes a lot of time and is very inefficient. Is there any way to avoid reloading it the second time, in the second line p = Popen(...), i.e. just loading it once in the beginning and continue using that instance? I tried to remove the second line unsuccessfully, Python complains:
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ integrating-java-with-python
Integrating Java with Python - GeeksforGeeks
July 23, 2025 - For example, if we are writing our Java program in Eclipse, we need to include the jar file of py4j in the Java project. It is important to point out that py4j supports Java version 6 and above only. Let us examine a simple Java program HelloClass.java that has a method Message which returns Hello. To make the GFG accessible in a Python program, two things are required. First, the Python program should be able to access the Java Virtual Machine (JVM) running the Java program. This requires an instance of the GatewayServer class available in the library py4j that makes this communication possible.