title: Using OpenAi's Gym Java Client
body: <p>I'm trying to utilise the Java port of OpenAi's gym - as I've been using Java instead of Python.</p>
  
  <p>I've cloned <a href="https://github.com/eclipse/deeplearning4j/tree/master/gym-java-client" rel="nofollow noreferrer">the gym's repo</a> which is a submodule of <a href="https://github.com/eclipse/deeplearning4j" rel="nofollow noreferrer">the "mono-repo"</a>.</p>
  
  <p>Within my project, in IntelliJ, I setup a dependency on the gym project (source code) but nothing's getting picked up.</p>
  
  <p>After opening the gym project itself, within IntelliJ, none of the dependencies are being resolved, and the maven <code>pom.xml</code> file has a multitude of errors. </p>
  
  <hr>
  
  <p>The first error is to the with the unrecognised parent module (the mono-repo).</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.deeplearning4j&lt;/groupId&gt;
      &lt;artifactId&gt;deeplearning4j&lt;/artifactId&gt;
      &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
  &lt;/parent&gt;
  </code></pre>
  
  <p>I tried setting up / building the mono-repo to no avail. I also was trying to figure out whether building the entire mono-repo was necessary - and not simply just including a <em>load</em> of redundant dependencies / modules.</p>
  
  <p>Has anyone actually made use of this Java Client? 
  The repo has extremely brief documentation, and I've not seen any example usages online</p>
  
  <hr>
  
  <p><strong><em>EDIT</em></strong></p>
  
  <p>Since posting this question the gym stuff has been removed from the deeplearning4j repository.</p>
  
  <p>There still seems to be an implementation in the rl4j repository, which I've managed to pull as a maven dependency into my project.</p>
  
  <p>When trying to run a basic cartpole example I get the error:</p>
  
  <pre><code>SLF4J: Defaulting to no-operation (NOP) logger implementation
  SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
  Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.RuntimeException: Connection error
      at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
      at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
      at dentai.main.main(main.java:111)
  Caused by: java.lang.RuntimeException: Connection error
      at org.deeplearning4j.gym.ClientUtils.unirestCrash(ClientUtils.java:71)
      at org.deeplearning4j.gym.ClientUtils.post(ClientUtils.java:39)
      at org.deeplearning4j.gym.ClientFactory.build(ClientFactory.java:40)
      at org.deeplearning4j.gym.ClientFactory.build(ClientFactory.java:58)
      at org.deeplearning4j.rl4j.mdp.gym.GymEnv.&lt;init&gt;(GymEnv.java:46)
      at dentai.problems.CartPole.test(CartPole.java:18)
      at dentai.main.lambda$main$0(main.java:107)
      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      at java.base/java.lang.Thread.run(Thread.java:830)
  Caused by: com.mashape.unirest.http.exceptions.UnirestException: org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:5000 [/127.0.0.1] failed: Connection refused: no further information
      at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:143)
      at com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68)
      at org.deeplearning4j.gym.ClientUtils.post(ClientUtils.java:37)
      ... 9 more
  Caused by: org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:5000 [/127.0.0.1] failed: Connection refused: no further information
      at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:159)
      at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359)
      at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
      at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
      at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
      at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
      at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
      at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
      at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
      at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
      at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
      at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:138)
      ... 11 more
  </code></pre>