【问题标题】:IllegalStateException: No language and polyglot implementation was found on the classpath. Make sure the truffle-api.jar is on the classpathIllegalStateException:在类路径上找不到语言和多语言实现。确保 truffle-api.jar 在类路径中
【发布时间】:2019-01-27 02:09:14
【问题描述】:
IllegalStateException: No language and polyglot implementation was found on the
classpath. Make sure the truffle-api.jar is on the classpath.

我想在我的 Java 项目中使用 GraalVM。

我将此依赖项添加到我的 pom.xml 中

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

但显然这还不够。

我还需要做什么来修复这个错误?

【问题讨论】:

  • 为什么只添加特定的依赖项?你读到了什么认为这已经足够了? --- 无论如何,照它说的做,找到 truffle-api.jar 的依赖并添加它。
  • 这里有一个名为“在股票 JDK 上运行 Graal.js **”的部分:stackoverflow.com/a/52200711/1087978
  • “在我的 Java 项目中使用 GraalVM”是什么意思?

标签: java java-11 graalvm


【解决方案1】:

必须添加所有这些依赖项:

<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>

【讨论】:

  • 天啊,太不明显了。他们在文档中的某个地方更新了吗?
【解决方案2】:
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'    

【讨论】:

  • 良好的 Gradle 替代品
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-12
  • 2021-01-13
  • 2013-12-17
  • 1970-01-01
  • 1970-01-01
  • 2021-09-23
相关资源
最近更新 更多