title: How to use GraalVM in Java? class not found exception
body: <p>I want to make this example to work: <a href="https://github.com/graalvm/graal-js-jdk11-maven-demo/blob/master/src/main/java/com/mycompany/app/App.java" rel="nofollow noreferrer">https://github.com/graalvm/graal-js-jdk11-maven-demo/blob/master/src/main/java/com/mycompany/app/App.java</a></p>
  
  <p>But I get an exception in thread "main" java.lang.NoClassDefFoundError: jdk/vm/ci/services/Services</p>
  
  <p>I included GraalVM via Maven</p>
  
  <p>The same exception is thrown in this minimal example</p>
  
  <pre><code>import org.graalvm.polyglot.Context;
  
  public class Main {
      public static void main(String[] args) {
          Context context = Context.create("js");
          context.eval("js", "console.log('Hello from Earth')");
      }
  }
  </code></pre>
  
  <p>The pom</p>
  
  <pre><code>&lt;dependencies&gt;
    &lt;!-- https://mvnrepository.com/artifact/org.graalvm.sdk/graal-sdk --&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;org.graalvm.sdk&lt;/groupId&gt;
  &lt;artifactId&gt;graal-sdk&lt;/artifactId&gt;
  &lt;version&gt;19.1.1&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;!-- https://mvnrepository.com/artifact/org.graalvm.js/js --&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;org.graalvm.js&lt;/groupId&gt;
  &lt;artifactId&gt;js&lt;/artifactId&gt;
  &lt;version&gt;19.1.1&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;!-- https://mvnrepository.com/artifact/org.graalvm.js/js-scriptengine --&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;org.graalvm.js&lt;/groupId&gt;
  &lt;artifactId&gt;js-scriptengine&lt;/artifactId&gt;
  &lt;version&gt;19.1.1&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;!-- https://mvnrepository.com/artifact/org.graalvm.compiler/compiler --&gt;
  &lt;dependency&gt;
  &lt;groupId&gt;org.graalvm.compiler&lt;/groupId&gt;
  &lt;artifactId&gt;compiler&lt;/artifactId&gt;
  &lt;version&gt;19.1.1&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>I am using jdk-12.0.1 (Open JDK) and working on a Windows 10 computer. </p>
  
  <p>Somewhere on the internet I found that this</p>
  
  <pre><code> -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler
  </code></pre>
  
  <p>should be included as VM arguments. When I do that the exception changes to:</p>
  
  <p>Exception in thread "main" java.lang.IllegalAccessError: class org.graalvm.compiler.truffle.runtime.hotspot.AbstractHotSpotTruffleRuntimeAccess (in unnamed module @0x2d8e6db6) cannot access class jdk.vm.ci.services.Services (in module jdk.internal.vm.ci) because module jdk.internal.vm.ci does not export jdk.vm.ci.services to unnamed module @0x2d8e6db6 </p>
  
  <p>Maybe there is a problem with the modules: modules-info.java</p>
  
  <pre><code>module App {
  exports testinggraal;
  
  requires org.graalvm.sdk;
  requires java.scripting;
  requires org.graalvm.truffle;
  requires org.graalvm.js;
   }
  </code></pre>