Minimum working example:
import py4j.GatewayServer;
public class AdditionApplication {
public static void main(String[] args) {
AdditionApplication app = new AdditionApplication();
GatewayServer server = new GatewayServer(app);
server.start();
}
}
Compile (make sure that the path -cpto py4j is valid, otherwise configure it so that it points to the right place):
javac -cp /usr/local/share/py4j/py4j0.9.jar AdditionApplication.java
Run it:
java -cp .:/usr/local/share/py4j/py4j0.9.jar AdditionApplication
, python script, , java AdditionApplication, - :
>>> Hello World!