GraalVM IllegalArgumentException: A language with id ‘xx‘ is not installed. Installed languag

简介: GraalVM IllegalArgumentException: A language with id ‘xx‘ is not installed. Installed languag

就是想体验GraalVM使用多语言的时候报错

    public static void main(String[] args) {
        System.out.println("Hello World from Java!");

        Context context = Context.newBuilder().allowAllAccess(true).build();

        context.eval("js", "print('Hello World from JavaScript!');");
        context.eval("python", "print('Hello World from Python!')");
        context.eval("ruby", "puts 'Hello World from Ruby!'");
    }

报错信息

Exception in thread "main" java.lang.IllegalArgumentException: A language with id 'js' is not installed. Installed languages are: [].
  at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotEngineException.illegalArgument(PolyglotEngineException.java:131)
  at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotEngineImpl.throwNotInstalled(PolyglotEngineImpl.java:1105)
  at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotEngineImpl.requirePublicLanguage(PolyglotEngineImpl.java:1112)
  at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.requirePublicLanguage(PolyglotContextImpl.java:1502)
  at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.lookupLanguageContext(PolyglotContextImpl.java:1464)
  at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.eval(PolyglotContextImpl.java:1473)
  at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextDispatch.eval(PolyglotContextDispatch.java:63)
  at org.graalvm.sdk/org.graalvm.polyglot.Context.eval(Context.java:403)
  at org.graalvm.sdk/org.graalvm.polyglot.Context.eval(Context.java:429)
  at icu.yujing.blog.GraalVMTest.main(GraalVMTest.java:19)

进程已结束,退出代码为 1

提示没安装 安装就好了(未配置graalvm的环境变量时, 应在graalvm包下的bin目录执行命令)

PS F:\ProgramsDev\JDK\graalvm-jdk-17.0.8+9.1\bin> .\gu install js
Downloading: Artifacts catalog from gds.oracle.com
Skipping ULN EE channels, no username provided.
Downloading: Component catalog from www.graalvm.org
Processing Component: Graal.js
Processing Component: ICU4J
Processing Component: TRegex
Additional Components are required:
    ICU4J (org.graalvm.icu4j, version 23.0.1), required by: Graal.js (org.graalvm.js)
    TRegex (org.graalvm.regex, version 23.0.1), required by: Graal.js (org.graalvm.js)
Downloading: Component js: Graal.js from gds.oracle.com
Downloading: Component org.graalvm.icu4j: ICU4J from gds.oracle.com
Downloading: Component org.graalvm.regex: TRegex from gds.oracle.com
Installing new component: TRegex (org.graalvm.regex, version 23.0.1)
Installing new component: ICU4J (org.graalvm.icu4j, version 23.0.1)
Installing new component: Graal.js (org.graalvm.js, version 23.0.1)

graalvm是什么?如何使用?

You can use GraalVM like a Java Development Kit (JDK) in your IDE.

您可以在IDE中像Java开发工具包(JDK)一样使用GraalVM。

相关文章
|
Java Maven
Maven - Error:java: Annotation processing is not supported for module cycles. Please ensure that all
Maven - Error:java: Annotation processing is not supported for module cycles. Please ensure that all
987 0
Maven - Error:java: Annotation processing is not supported for module cycles. Please ensure that all
|
Ubuntu Unix Linux
成功解决ERROR: Unable to find the development tool `cc` in your path; please make sure that you have the
成功解决ERROR: Unable to find the development tool `cc` in your path; please make sure that you have the
成功解决ERROR: Unable to find the development tool `cc` in your path; please make sure that you have the
|
4月前
|
开发者 Python
【Python】已解决:ERROR: Could not find a version that satisfies the requirement easyocr (from versions: n
【Python】已解决:ERROR: Could not find a version that satisfies the requirement easyocr (from versions: n
125 0
|
4月前
|
开发者 Python
【Python】已完美解决:ERROR: Could not find a version that satisfies the requirement re
【Python】已完美解决:ERROR: Could not find a version that satisfies the requirement re
567 0
kali2022.1The following packages were automatically installed and are no longer required
kali2022.1The following packages were automatically installed and are no longer required
84 1
|
6月前
|
Linux Docker 容器
problem with installed package podman-1.4.2-5.module_el8.1.0
problem with installed package podman-1.4.2-5.module_el8.1.0
46 0
|
Java 应用服务中间件 Apache
An incompatible version [1.2.7] of the APR based Apache Tomcat Native library is installed
An incompatible version [1.2.7] of the APR based Apache Tomcat Native library is installed
An incompatible version [1.2.7] of the APR based Apache Tomcat Native library is installed
|
Python
Python安装库Could not find a version that satisfies the requirement requests (from versions: none)
Python安装库Could not find a version that satisfies the requirement requests (from versions: none)
130 1
libcanberra development package not found
libcanberra development package not found
63 0
成功解决The following specifications were found to be incompatible with the existing python installation
成功解决The following specifications were found to be incompatible with the existing python installation