# Java binding to ray fails during Ray.init() call

**URL:** <https://discuss.ray.io/t/java-binding-to-ray-fails-during-ray-init-call/991>\
**Category:** Ray Core\
**Created:** [February 23, 2021, 5:27pm UTC](https://discuss.ray.io/t/java-binding-to-ray-fails-during-ray-init-call/991 "2021-02-23T17:27:50Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![folker.hoffmann](https://avatars.discourse-cdn.com/v4/letter/f/b5ac83/32.png) [@folker.hoffmann](https://discuss.ray.io/u/folker.hoffmann)\
**Post date:** [February 23, 2021, 5:27pm UTC](https://discuss.ray.io/t/java-binding-to-ray-fails-during-ray-init-call/991/1 "2021-02-23T17:27:50Z")

</div>

Hello,

I want to experiment with the java bindings for ray. I used ray version 1.2.0 (installed via pip) and the same for the java version (ray-api and ray-runtime both at 1.2.0, using Gradle). The code consists only of the “Ray.init()” call. However, I get the exception

> Error: Invalid value for ‘–system-config’: {put\_small\_object\_in\_memory\_store:false}

and the program crashes. My understanding from the documentation ([Configuring Ray — Ray 3.0.0.dev0](https://docs.ray.io/en/master/configure.html#java-applications)) is that no additional configuration is required for a single node cluster. Am I doing anything wrong?

Full output:

> Exception in thread “main” java.lang.RuntimeException: Failed to initialize Ray runtime.  
> at io.ray.api.Ray.init(Ray.java:27)  
> at main.Main.main(Main.java:12)  
> 2021-02-23 18:14:59,133 ERROR DefaultRayRuntimeFactory [main]: Failed to initialize ray runtime, with config {“ray”:{“address”:null,“head-args”:,“job”:{“code-search-path”:“”,“id”:“”,“jvm-options”:,“num-java-workers-per-process”:1,“worker-env”:{}},“logging”:{“dir”:“”,“level”:“INFO”,“max-backup-files”:10,“max-file-size”:“500MB”,“pattern”:“%d{yyyy-MM-dd HH:mm:ss,SSS} %p %c{1} [%t]: %m%n”},“object-store”:{“socket-name”:null},“raylet”:{“config”:{“put\_small\_object\_in\_memory\_store”:false},“node-manager-port”:0,“socket-name”:null},“redis”:{“password”:“5241590000000000”},“run-mode”:“CLUSTER”,“session-dir”:null}}  
> Caused by: java.lang.RuntimeException: Failed to initialize ray runtime  
> java.lang.RuntimeException: Failed to start Ray runtime.  
> at io.ray.runtime.DefaultRayRuntimeFactory.createRayRuntime(DefaultRayRuntimeFactory.java:43)  
> at io.ray.api.Ray.init(Ray.java:38)  
> at io.ray.api.Ray.init(Ray.java:25)  
> at io.ray.runtime.runner.RunManager.startRayHead(RunManager.java:41)  
> … 1 more  
> Caused by: java.lang.RuntimeException: Failed to initialize ray runtime
> 
> at io.ray.runtime.RayNativeRuntime.start(RayNativeRuntime.java:75)  
> Caused by: java.lang.RuntimeException: Failed to start Ray runtime.  
> Caused by: java.lang.RuntimeException: Failed to start Ray runtime.
> 
> at io.ray.runtime.DefaultRayRuntimeFactory.createRayRuntime(DefaultRayRuntimeFactory.java:39)  
> at io.ray.runtime.runner.RunManager.startRayHead(RunManager.java:41)  
> at io.ray.api.Ray.init(Ray.java:38)  
> at io.ray.runtime.RayNativeRuntime.start(RayNativeRuntime.java:75)  
> at io.ray.api.Ray.init(Ray.java:25)  
> at main.Main.main(Main.java:12)  
> at io.ray.runtime.DefaultRayRuntimeFactory.createRayRuntime(DefaultRayRuntimeFactory.java:39)  
> … 3 more  
> Caused by: java.lang.RuntimeException: The exit value of the process is 2. Command: ray start --head --redis-password 5241590000000000 --system-config={“put\_small\_object\_in\_memory\_store”:false}  
> Caused by: java.lang.RuntimeException: The exit value of the process is 2. Command: ray start --head --redis-password 5241590000000000 --system-config={“put\_small\_object\_in\_memory\_store”:false}  
> output:  
> output:  
> Usage: ray start [OPTIONS]  
> Usage: ray start [OPTIONS]  
> Try ‘ray start --help’ for help.  
> Try ‘ray start --help’ for help.
> 
> Error: Invalid value for ‘–system-config’: {put\_small\_object\_in\_memory\_store:false}
> 
> Caused by: java.lang.RuntimeException: The exit value of the process is 2. Command: ray start --head --redis-password 5241590000000000 --system-config={“put\_small\_object\_in\_memory\_store”:false}
> 
> Error: Invalid value for ‘–system-config’: {put\_small\_object\_in\_memory\_store:false}  
> at io.ray.runtime.runner.RunManager.runCommand(RunManager.java:117)
> 
> at io.ray.runtime.runner.RunManager.startRayHead(RunManager.java:39)  
> … 5 more  
> at io.ray.runtime.runner.RunManager.runCommand(RunManager.java:117)  
> at io.ray.runtime.runner.RunManager.startRayHead(RunManager.java:39)  
> … 5 more  
> Error: Invalid value for ‘–system-config’: {put\_small\_object\_in\_memory\_store:false}
> 
> > Task :Main.main() FAILED
> 
> Execution failed for task ‘:Main.main()’.

---

<div class="post-metadata">

**Author:** ![folker.hoffmann](https://avatars.discourse-cdn.com/v4/letter/f/b5ac83/32.png) [@folker.hoffmann](https://discuss.ray.io/u/folker.hoffmann)\
**Post date:** [February 23, 2021, 5:29pm UTC](https://discuss.ray.io/t/java-binding-to-ray-fails-during-ray-init-call/991/2 "2021-02-23T17:29:53Z")

</div>

Just for completeness, this is my application:

> package main;
> 
> import io.ray.api.Ray;
> 
> public class Main {  
> public static void main(String args) {  
> Ray.init();  
> }  
> }

---

<div class="post-metadata">

**Author:** ![rliaw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rliaw/32/24_2.png) [@rliaw](https://discuss.ray.io/u/rliaw)\
**Post date:** [February 24, 2021, 6:55pm UTC](https://discuss.ray.io/t/java-binding-to-ray-fails-during-ray-init-call/991/3 "2021-02-24T18:55:07Z")

</div>

@Alex could you take a look here?

---

<div class="post-metadata">

**Author:** ![Alex](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/alex/32/341_2.png) [@Alex](https://discuss.ray.io/u/Alex)\
**Post date:** [February 24, 2021, 11:40pm UTC](https://discuss.ray.io/t/java-binding-to-ray-fails-during-ray-init-call/991/4 "2021-02-24T23:40:13Z")

</div>

This looks like a bug. Can we move this issue to github?

@simon-mo we didn’t end up touching this flag did we?

cc @raulchen

---

<div class="post-metadata">

**Author:** ![jjgriffin2](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/jjgriffin2/32/379_2.png) [@jjgriffin2](https://discuss.ray.io/u/jjgriffin2)\
**Post date:** [March 3, 2021, 8:37pm UTC](https://discuss.ray.io/t/java-binding-to-ray-fails-during-ray-init-call/991/5 "2021-03-03T20:37:47Z")

</div>

I have a similar test program with the same results. In my case, the error is  
2021-03-03 14:32:47,496 INFO RunManager [main]: Ray runtime started @ 10.0.0.214.  
2021-03-03 14:32:48,715 ERROR DefaultRayRuntimeFactory [main]: Failed to initialize ray runtime, with config {“ray”:{“address”:“10.0.0.214:6379”,“head-args”:[],“job”:{“code-search-path”:"",“id”:"",“jvm-options”:[],“num-java-workers-per-process”:1,“worker-env”:{}},“logging”:{“dir”:"",“level”:“INFO”,“max-backup-files”:10,“max-file-size”:“500MB”,“pattern”:"%d{yyyy-MM-dd HH:mm:ss,SSS} %p %c{1} [%t]: %m%n"},“object-store”:{“socket-name”:null},“raylet”:{“config”:{“put\_small\_object\_in\_memory\_store”:false},“node-manager-port”:0,“socket-name”:null},“redis”:{“password”:“5241590000000000”},“run-mode”:“CLUSTER”,“session-dir”:"/tmp/ray/session\_2021-03-03\_14-32-45\_731362\_6982"}}

---

<div class="post-metadata">

**Author:** ![raghukiran](https://avatars.discourse-cdn.com/v4/letter/r/e68b1a/32.png) [@raghukiran](https://discuss.ray.io/u/raghukiran)\
**Post date:** [March 31, 2021, 5:40pm UTC](https://discuss.ray.io/t/java-binding-to-ray-fails-during-ray-init-call/991/6 "2021-03-31T17:40:37Z")

</div>

I tried something similar and I am getting a ClassNotFoundException!

Caused by: java.lang.ClassNotFoundException: io.ray.runtime.DefaultRayRuntimeFactory

---

<div class="post-metadata">

**Author:** ![raulchen](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/raulchen/32/330_2.png) [@raulchen](https://discuss.ray.io/u/raulchen)\
**Post date:** [April 6, 2021, 6:24am UTC](https://discuss.ray.io/t/java-binding-to-ray-fails-during-ray-init-call/991/7 "2021-04-06T06:24:13Z")

</div>

@raghukiran did you add `ray-runtime` in your dependencies?

---

<div class="post-metadata">

**Author:** ![raulchen](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/raulchen/32/330_2.png) [@raulchen](https://discuss.ray.io/u/raulchen)\
**Post date:** [April 6, 2021, 8:03am UTC](https://discuss.ray.io/t/java-binding-to-ray-fails-during-ray-init-call/991/8 "2021-04-06T08:03:34Z")

</div>

@folker.hoffmann I believe this issue is related to command line argument parsing. But I cannot reproduce this on my machine.  
What is your OS and Java version?

---

<div class="post-metadata">

**Author:** ![raghukiran](https://avatars.discourse-cdn.com/v4/letter/r/e68b1a/32.png) [@raghukiran](https://discuss.ray.io/u/raghukiran)\
**Post date:** [April 6, 2021, 12:29pm UTC](https://discuss.ray.io/t/java-binding-to-ray-fails-during-ray-init-call/991/9 "2021-04-06T12:29:57Z")

</div>

yes, my pom has:

On Slack (Ray), someone mentioned that I need to provide the python install path for Ray. Maybe this is missing from the docs? Also, would be good to know how to do this in an IDE like intelliJ.

 io.ray ray-api 1.2.0 io.ray ray-runtime 1.2.0

---

<div class="post-metadata">

**Author:** ![raulchen](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/raulchen/32/330_2.png) [@raulchen](https://discuss.ray.io/u/raulchen)\
**Post date:** [April 7, 2021, 7:19am UTC](https://discuss.ray.io/t/java-binding-to-ray-fails-during-ray-init-call/991/10 "2021-04-07T07:19:43Z")

</div>

> [@raghukiran](#):
>
> ClassNotFoundException

Are you still getting the ClassNotFoundException after adding `ray-runtime`? This error should have nothing to do with the Python path. If you still see this, can you try printing your classpath and see if the ray-runtime jar is actually there?
