4
IllegalStateException: No language and polyglot implementation was found on the
classpath. Make sure the truffle-api.jar is on the classpath.

I wanted to use GraalVM in my Java project.

I added this dependency to my pom.xml

<dependency>
  <groupId>org.graalvm.js</groupId>
  <artifactId>js-scriptengine</artifactId>
  <version>1.0.0-rc10</version>
</dependency>

but apparently that's not enough.

What else do I have to do to fix this error?

theonlygusti
  • 11,032
  • 11
  • 64
  • 119
  • 2
    Why did you add that specific dependency only? What did you read to think that was enough? --- Anyway, do what it says, find the dependency for truffle-api.jar and add that too. – Andreas Jan 27 '19 at 02:38
  • There's a section called "Running Graal.js on a stock JDK** " here: https://stackoverflow.com/a/52200711/1087978 – Oleg Šelajev Jan 27 '19 at 15:20
  • What do you mean by "use GraalVM in my Java project."? – BoriS Jan 29 '19 at 07:39

2 Answers2

9

Had to add all these dependencies:

<dependency>
  <groupId>org.graalvm.js</groupId>
  <artifactId>js</artifactId>
  <version>1.0.0-rc10</version>
</dependency>
<dependency>
  <groupId>org.graalvm.js</groupId>
  <artifactId>js-scriptengine</artifactId>
  <version>1.0.0-rc10</version>
</dependency>
<dependency>
  <groupId>org.graalvm.truffle</groupId>
  <artifactId>truffle-api</artifactId>
  <version>1.0.0-rc10</version>
</dependency>
theonlygusti
  • 11,032
  • 11
  • 64
  • 119
4
implementation 'org.graalvm.sdk:graal-sdk:20.1.0'
implementation 'org.graalvm.truffle:truffle-api:20.1.0'
implementation 'org.graalvm.js:js:20.1.0'    
sparkyspider
  • 13,195
  • 10
  • 89
  • 133