--- title: Data Processing with GraalJS sidebar_label: Java + GraalJS pagination_prev: demos/bigdata/index pagination_next: solutions/input --- import current from '/version.js'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; [GraalJS](https://www.graalvm.org/latest/reference-manual/js/) is a JS engine for Java. The project offers a JSR-223 compliant OpenJDK-compatible build. [SheetJS](https://sheetjs.com) is a JavaScript library for reading and writing data from spreadsheets. The ["Complete Example"](#complete-example) section includes a complete Java command-line tool for reading data from spreadsheets and printing CSV rows. :::info pass The Java packages used in this demo are covered under open source licenses. The Universal Permissive License covers most of the packages, while `icu4j` uses a different, yet still permissive, license. ::: ## Integration Details :::info pass When this demo was last tested, raw byte arrays could not be passed to GraalJS. **This is a limitation of the default GraalJS behavior.** Instead, this demo uses Nashorn Compatibility Mode[^1] through a runtime flag: ```js java -Dpolyglot.js.nashorn-compat=true ... ``` ::: The [Nashorn demo](/docs/demos/engines/nashorn) code and explanation applies to JSR-223 compatible `ScriptEngine` implementations, including GraalJS. ## Complete Example :::note Tested Deployments This demo was tested in the following deployments: | OpenJDK | GraalJS | Date | |:--------|:--------|:-----------| | 26 | 25.0.2 | 2026-05-07 | | 25.0.2 | 25.0.2 | 2026-05-07 | | 24.0.2 | 25.0.2 | 2026-05-07 | | 23.0.2 | 25.0.2 | 2026-05-07 | | 22.0.2 | 25.0.2 | 2026-05-07 | | 21.0.10 | 25.0.2 | 2026-05-07 | | 20.0.2 | 25.0.2 | 2026-05-07 | | 19.0.2 | 25.0.2 | 2026-05-07 | | 18.0.2 | 25.0.2 | 2026-05-07 | | 17.0.18 | 25.0.2 | 2026-05-07 | ::: ### Compilation 0) Download GraalJS and its dependencies: ```bash curl -LO "https://repo1.maven.org/maven2/org/graalvm/js/js-scriptengine/25.0.2/js-scriptengine-25.0.2.jar" curl -LO "https://repo1.maven.org/maven2/org/graalvm/js/js-language/25.0.2/js-language-25.0.2.jar" curl -LO "https://repo1.maven.org/maven2/org/graalvm/polyglot/polyglot/25.0.2/polyglot-25.0.2.jar" curl -LO "https://repo1.maven.org/maven2/org/graalvm/sdk/collections/25.0.2/collections-25.0.2.jar" curl -LO "https://repo1.maven.org/maven2/org/graalvm/truffle/truffle-api/25.0.2/truffle-api-25.0.2.jar" curl -LO "https://repo1.maven.org/maven2/org/graalvm/sdk/nativeimage/25.0.2/nativeimage-25.0.2.jar" curl -LO "https://repo1.maven.org/maven2/org/graalvm/shadowed/icu4j/25.0.2/icu4j-25.0.2.jar" curl -LO "https://repo1.maven.org/maven2/org/graalvm/regex/regex/25.0.2/regex-25.0.2.jar" ``` 1) Download the SheetJS Standalone script, shim script and test file. Move all three files to the project directory: