APIs for calling Java functions and actors from Python.
Define a Java function to call from Python.
java_func = ray.cross_language.java_function(
class_name="com.example.MyClass",
function_name="myMethod"
)
result = java_func.remote(arg1, arg2)Parameters:
class_name: Fully qualified Java class namefunction_name: Java method name
Returns: Remote function that can be called with .remote()
Define a Java actor class to use from Python.
JavaActor = ray.cross_language.java_actor_class(
class_name="com.example.MyActor"
)
actor = JavaActor.remote(arg1, arg2)
result = actor.method.remote()Parameters:
class_name: Fully qualified Java actor class name
Returns: Actor class that can be instantiated with .remote()
Note: Requires Java code to be available in the code search path specified in JobConfig.