Using an Op-code to Connect to an RMI Server

It is also possible to connect to an RMI server by calling the C$JAVA routine with op-code CJAVA-NEWREMOTEOBJECT. It is very much like the CJAVA-NEW op-code, but instead of creating an object in the local JVM, it creates an instance of a remote object. This op-code takes three parameters: the host name, the server name, and the port number. Here is an example of the call:

CALL "C$JAVA" USING CJAVA-NEWREMOTEOBJECT, "localhost", "TestRemoteInterface", PORT-NUMBER GIVING REMOTE-OBJ.

CALL "C$JAVA" USING CJAVA-CALL, REMOTE-OBJ, "acuUtilities/TestRemoteInterface", "TestRemoteMethod",  "()X", FIELD-STRINGRET GIVING STATUS-VAL.

CALL "C$JAVA" USING CJAVA-DELETE, REMOTE-OBJ GIVING STATUS-VAL.