- Why GraalVM?
- Getting Started
- Container Images
- Java Performance Examples
- Java Stream API Example
- Polyglot Node.js Example
- Native Image Examples
- Java/Kotlin Native Image Example
- Reference Manuals
- Debugging and Monitoring Tools
- GraalVM as a Platform
- Security Guide
- Release Notes
This page describes an example of a polyglot application you can run with GraalVM.
1. Download or clone the repository and navigate into the
2. Install GraalVM on your platform.
3. To run the demo, you need to enable Node.js support in GraalVM:
gu install nodejs
4. This application contains R code. The R language support is not enabled by default in GraalVM and you should add it too:
gu install R
5. Build the benchmark. You can manually execute
npm install, but there is also a
build.sh script included for your convenience:
Running the Application #
To run the application, you need to execute the
You can run it with the following command (or run the
$GRAALVM_HOME/bin/node --polyglot --jvm server.js
If you would like to run the benchmark on a different instance of Node,
you can run it with whatever
node you have. However, presumably, the polyglot
capability will not be supported.
Debugging Polyglot Applications #
GraalVM also supports debugging of polyglot applications and provides a built-in
implementation of the Chrome DevTools Protocol. Add the
--inspect parameter to the command line, open the URL the application
prints at the startup in the Chrome browser, and start debugging: set breakpoints,
Note about the Application #
For brevity, this sample application contains large snippets of code inside the strings. This is not the best approach for structuring polyglot applications, but it is the easiest way to demonstrate polyglot capabilities in a single file.