Previous topic

3. Advanced Topics

Next topic

4.1. py4j.java_gateway — Py4J Main API

This Page

4. Py4J Python API

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.