Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a classpath while no direct access to Node #799

Open
chrisdhanaraj opened this issue Feb 19, 2024 · 2 comments
Open

Adding a classpath while no direct access to Node #799

chrisdhanaraj opened this issue Feb 19, 2024 · 2 comments

Comments

@chrisdhanaraj
Copy link

chrisdhanaraj commented Feb 19, 2024

Hey there! I'm trying to leverage Graal to run Remix (React metaframework), but I run into a couple of issues - the most pressing one is that I can't add a --vm.cp anywhere to expose a Java class to my application

WebAssembly: Initially I get blocked by a WebAssembly error, which I can get around by enabling WebAssembly by leveraging the steps here.

then, when I want to add a Java class to my app, there doesn't seem to be a way to add in a --vm.cp to a command that looks like npm run remix dev.

When I try to spawn a node child-process that runs that and attach the --vm.cp script there, an error is flagged that I'm not in a polyglot environment, even though the argument has been set. Removing the vm.cp argument drops the polyglot env error.

What's the best way to tackle this?

@chrisdhanaraj
Copy link
Author

Adding some more context, if I run this command

"dev": "NODE_OPTIONS='--polyglot' NODE_POLYGLOT_OPTIONS='--js.webassembly --experimental-options' remix dev --manual",

This is where I can't seem to add a vm.cp argument anywhere. If I try to do a Java.addToClasspath(), I can't do it in native mode.

However, if I do add a --jvm flag in there (just trying out everything), I run into the same WebAssembly error (where it thinks polyglot is not enabled, despite the flag being present)

@woess
Copy link
Member

woess commented Apr 24, 2024

As of 24.x, WebAssembly is enabled by default in Node now, so it should not be necessary to use these options anymore. I think in the graalnodejs-community-jvm standalone, both --vm.cp and Java.addToClasspath() should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants