Using Py4J is usually as simple as creating a JavaGateway object:
java_gateway = JavaGateway()
# you are now connected to the JVM
# and you can call any method defined on the Java side.
You can still customize and extend Py4J in many ways (e.g., you can choose the
port to which you want to connect). The following modules are documented. Note
that users are expected to only use py4j.java_gateway
or
py4j.clientserver
.
py4j.java_gateway
— Py4J Main APIJavaGateway
JavaGateway.close()
JavaGateway.close_callback_server()
JavaGateway.detach()
JavaGateway.get_callback_server()
JavaGateway.help()
JavaGateway.launch_gateway()
JavaGateway.new_array()
JavaGateway.new_jvm_view()
JavaGateway.restart_callback_server()
JavaGateway.set_gateway_client()
JavaGateway.shutdown()
JavaGateway.shutdown_callback_server()
JavaGateway.start_callback_server()
py4j.clientserver
— Py4J Single Threading Model ImplementationClientServerConnection
ClientServerConnection.close()
ClientServerConnection.connect_to_java_server()
ClientServerConnection.init_socket_from_python_server()
ClientServerConnection.run()
ClientServerConnection.send_command()
ClientServerConnection.shutdown_gateway()
ClientServerConnection.shutdown_socket()
ClientServerConnection.start()
ClientServerConnection.wait_for_commands()
py4j.protocol
— Py4J Protocol
py4j.java_collections
— Py4J Collections API
py4j.finalizer
— Py4J Finalizer API
py4j.signals
— Py4J Signals API