Implementation:Ray project Ray Ray Init Cross Language
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Distributed_Computing, Cross_Language_Interop |
| Last Updated | 2026-02-13 17:00 GMT |
Overview
Concrete tool for initializing Ray with cross-language code search path configuration provided by the Ray Java SDK.
Description
The same Ray.init() call, but preceded by setting the ray.job.code-search-path system property. RayConfig (L79, L187-195) reads this property and populates codeSearchPath: List<String>, which is passed to the Raylet so workers can discover foreign-language code.
Usage
Set the ray.job.code-search-path system property before calling Ray.init(). The value is a colon-separated list of directories containing Python and C++ code.
Code Reference
Source Location
- Repository: ray-project/ray
- File: java/api/src/main/java/io/ray/api/Ray.java (L15-33)
- File: java/runtime/src/main/java/io/ray/runtime/config/RayConfig.java (L79, L187-195)
Signature
// Set code search path before init
System.setProperty("ray.job.code-search-path", "/path/to/python/code:/path/to/cpp/libs");
Ray.init();
Import
import io.ray.api.Ray;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| ray.job.code-search-path | System property | Yes | Colon-separated list of directories with Python/C++ code |
Outputs
| Name | Type | Description |
|---|---|---|
| Ray.runtime | RayRuntime | Runtime with codeSearchPath configured for cross-language dispatch |
Usage Examples
Initialize for Cross-Language
import io.ray.api.Ray;
public class CrossLangApp {
public static void main(String[] args) {
// Set path to Python/C++ code
System.setProperty("ray.job.code-search-path", "/tmp/cross_lang_code");
// Initialize Ray with cross-language support
Ray.init();
// Now PyFunction.of() and CppFunction.of() can be used
// ...
Ray.shutdown();
}
}
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment