Enables Python to dynamically access arbitrary Java objects (ctypes/cffi-based Barthelemy Dagenais's Py4J)
Enables Python to dynamically access arbitrary Java objects.
jtypes.py4j enables Python programs to dynamically access arbitrary Java objects via Java’s Native Invocation Interface (JNI).jtypes.py4j is a lightweight Python Java package, based on the ctypes FFI library.It is an almost fully compliant implementation of Barthelemy Dagenais’s good known Py4J package by reimplementing whole it’s functionality in a clean Python via JNI instead of Python and Java via custom API service.
Note from the original website:
Welcome to 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. Py4J also enables Java programs to call back Python objects.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.>>> from py4j.java_gateway import JavaGateway >>> gateway = JavaGateway() # connect to the JVM >>> random = gateway.jvm.java.util.Random() # create a java.util.Random instance >>> number1 = random.nextInt(10) # call the Random.nextInt method >>> number2 = random.nextInt(10) >>> print(number1,number2) (2, 7)
- Java Runtime (JRE) or Java Development Kit (JDK), and NumPy.
pip install --upgrade jtypes.py4j
To ensure everything is running correctly you can run the tests using
python -m jt.py4j.tests
Copyright (c) 2014-2016, Adam KarpierzLicensed under the BSD licensePlease refer to the LICENSE file.
- Initial version.