I want to make this example to work: .java
But I get an exception in thread "main" java.lang.NoClassDefFoundError: jdk/vm/ci/services/Services
I included GraalVM via Maven
The same exception is thrown in this minimal example
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')");
}
}
The pom
<dependencies>
<!-- .graalvm.sdk/graal-sdk -->
<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>graal-sdk</artifactId>
<version>19.1.1</version>
</dependency>
<!-- .graalvm.js/js -->
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
<version>19.1.1</version>
</dependency>
<!-- .graalvm.js/js-scriptengine -->
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>19.1.1</version>
</dependency>
<!-- .graalvmpiler/piler -->
<dependency>
<groupId>org.graalvmpiler</groupId>
<artifactId>piler</artifactId>
<version>19.1.1</version>
</dependency>
</dependencies>
I am using jdk-12.0.1 (Open JDK) and working on a Windows 10 puter.
Somewhere on the internet I found that this
-XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler
should be included as VM arguments. When I do that the exception changes to:
Exception in thread "main" java.lang.IllegalAccessError: class org.graalvmpiler.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
Maybe there is a problem with the modules: modules-info.java
module App {
exports testinggraal;
requires org.graalvm.sdk;
requires java.scripting;
requires org.graalvm.truffle;
requires org.graalvm.js;
}
I want to make this example to work: https://github./graalvm/graal-js-jdk11-maven-demo/blob/master/src/main/java//mypany/app/App.java
But I get an exception in thread "main" java.lang.NoClassDefFoundError: jdk/vm/ci/services/Services
I included GraalVM via Maven
The same exception is thrown in this minimal example
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')");
}
}
The pom
<dependencies>
<!-- https://mvnrepository./artifact/org.graalvm.sdk/graal-sdk -->
<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>graal-sdk</artifactId>
<version>19.1.1</version>
</dependency>
<!-- https://mvnrepository./artifact/org.graalvm.js/js -->
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
<version>19.1.1</version>
</dependency>
<!-- https://mvnrepository./artifact/org.graalvm.js/js-scriptengine -->
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>19.1.1</version>
</dependency>
<!-- https://mvnrepository./artifact/org.graalvm.piler/piler -->
<dependency>
<groupId>org.graalvm.piler</groupId>
<artifactId>piler</artifactId>
<version>19.1.1</version>
</dependency>
</dependencies>
I am using jdk-12.0.1 (Open JDK) and working on a Windows 10 puter.
Somewhere on the internet I found that this
-XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler
should be included as VM arguments. When I do that the exception changes to:
Exception in thread "main" java.lang.IllegalAccessError: class org.graalvm.piler.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
Maybe there is a problem with the modules: modules-info.java
module App {
exports testinggraal;
requires org.graalvm.sdk;
requires java.scripting;
requires org.graalvm.truffle;
requires org.graalvm.js;
}
Share
Improve this question
edited Jul 29, 2019 at 22:55
asked Jul 25, 2019 at 23:49
user5354385user5354385
0
1 Answer
Reset to default 3I'm the author of https://github./graalvm/graal-js-jdk11-maven-demo and I looked into this, seems the problem is that the profiles are set up to work only with JDK11.
If you apply the following patch to the pom file of graal-js-jdk11-maven-demo it should work with JDK12 as well (as show by https://travis-ci/graalvm/graal-js-jdk11-maven-demo/jobs/564052535)
diff --git a/pom.xml b/pom.xml
index e2a76c1..95cfa2c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
<profile>
<id>jdk11</id>
<activation>
- <jdk>11</jdk>
+ <jdk>[11,</jdk>
</activation>
<dependencies>
<dependency>