promotional bannermobile promotional banner

GraalJS

A JavaScript language library.

GraalJS is a fast JavaScript language implementation built on top of GraalVM. It is ECMAScript-compliant, provides interoperability with Java and other Graal languages, common tooling, and, if run on the GraalVM JDK, provides the best performance with the Graal JIT compiler by default. You can also use GraalJS with Oracle JDK or OpenJDK.

This mod packages GraalJS to facilitate other mods using GraalJS without needing to package it separately.
This mod does not contain any active modifications. When used as a library, you only need to add the dependency using

implementation "dev.anye.mc:graaljs:1.21.x-24.2.1-1-Neo-all"

It includes an EasyJS class for easy invocation of GraalJS

LOGGER.info("1 + 1 = {}",EasyJS.NotSafe().runCode("1+1"));

You can also directly use GraalJS

static String JS_CODE = "(function myFun(param){console.log('Hello ' + param + ' from JS');})";

public static void main(String[] args) {
    String who = args.length == 0 ? "World" : args[0];
    System.out.println("Hello " + who + " from Java");
    try (Context context = Context.create()) {
        Value value = context.eval("js", JS_CODE);
        value.execute(who);
    }
}

Version number explanation: GraalJS-(Supported Minecraft version)-(GraalJS version)-(This mod version number)-(Mod loader identifier)-(Packaging type)
For example: GraalJS-1.21.x-24.2.1-1-Neo-lite

GraalJS: https://www.graalvm.org/javascript/
GraalJS Documentation: https://www.graalvm.org/reference-manual/js/
This project's GitHub: https://github.com/An-Mao/MC-GraalJS

----Attention----
· This is not an official GraalVM product. If you encounter non-code related issues, please contact me.
· When starting the game with a JDK that includes GraalJS (such as GraalVM), errors may occur. Please use the lite version in the attached files.

Any questions can be asked in github or contacted as below:

The GraalJS Team

profile avatar
Owner
  • 13
    Followers
  • 10
    Projects
  • 45.2K
    Downloads

More from AnMaoView all