Skip to content

node.exe --jvm --vm.cp=... xxx.js throws com.oracle.truffle.trufflenode.NativeAccess class not found! on GraalVM node.js 25.1.3 community edition #1088

Description

@dehade

Hi,

since version GRAALJS 25.0.2 the graalvm editions for node and jvm are not available any more.

How can the java Interoperability be setup, for example to use

"var HelloPolyglot = Java.type("HelloPolyglot");"

inside a js scrict for node.

In editions for node and jvm this was quite easy - just use node.exe --jvm --vm.cp=... xxx.js

Used editions on windows:
graalnode24-community-25.1.3-windows-amd64.zip
graalvm-community-jdk-25i1-25.0.3_windows-x64_bin.zip

App.js:

var HelloWorld = Java.type("com.example.App");

HelloWorld.main(["from node.js"]);

console.log("done");

HelloWorld java app:

package com.example;

import org.graalvm.polyglot.;
import org.graalvm.polyglot.proxy.
;

public class App {

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

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

Maven project for HelloWorld sucessfully created for graalvm 25.1.3.

jar file (with dependencies to graalvm polyglot, ...) successfully excuted through java.

CP refers to lib directory containing all modules from maven:
CP=C:\Users\DH\Test\lib

with jars:
collections-25.1.3.jar
helloworld-1.0-SNAPSHOT.jar
icu4j-25.1.3.jar
jniutils-25.1.3.jar
js-language-25.1.3.jar
nativeimage-25.1.3.jar
polyglot-25.1.3.jar
regex-25.1.3.jar
truffle-api-25.1.3.jar
compiler-25.1.3.jar
truffle-runtime-25.1.3.jar
word-25.1.3.jar
xz-25.1.3.jar

Result from executing node:
node --jvm --vm.cp=%CP\helloworld-1.0-SNAPSHOT.jar;%CP%\collections-25.1.3.jar;%CP%\icu4j-25.1.3.jar;%CP%\jnitools.jar;%CP%\js-language-25.1.3.jar;%CP%\nativeimage-25.1.3.jar;%CP%\polyglot-25.1.3.jar;%CP%\regex-25.1.3.jar;%CP%\truffle-api-25.1.3.jar;%CP%\truffle-compiler-25.1.3.jar;%CP%\truffle-runtime-25.1.3.jar;%CP%\word-25.1.3.jar;%CP%\xz-25.1.3.jar app.js
WARNING: Unknown module: org.graalvm.truffle specified to --enable-native-access
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by com.oracle.truffle.polyglot.JDKSupport in an unnamed module (file:/C:/Users/DH/Test/lib/truffle-api-25.1.3.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled

com.oracle.truffle.trufflenode.NativeAccess class not found!

There seem to be no jar that contains "com.oracle.truffle.trufflenode.NativeAccess".

How can the java Interoperability be received again with node outer structure which invokes Java classes, interfaces, and methods (as for the node jvm community editions) ?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions