Introduction

JS7 - GraalVM Jobs are based on Oracle® GraalVM and can be executed with any supported Java Virtual Machine (Oracle, OpenJDK). This allows use of JavaScript and Python jobs running in the Oracle® GraalVM but does not require using this flavor of the JVM.

For use with any supported JVM the Polyglot and Graal Compiler .jar files must be added to the JS7 Agent.

  • The Polyglot / Graal Compiler must be available for the Java version in use. Related . jar files must be copied to the  JS7 Agent's <agent-home>/lib/user_lib directoy.
  • At the time of writing Polyglot / Graal Compiler version 25 can be used with Java 17, 21, 25.

The download script for Graal Libraries is available for the following scenarios:

  • The JS7 Agent's machine has internet access and can download Graal Libraries and store them with the Agent.
  • The JS7 Agent's machine has no internet access. The script can be executed on any machine with internet access to add resulting Graal Libraries to a .tar.gz archive. Users can transfer the .tar.gz archive to the target Agent's machine and extract Graal Libraries.

The download script for Graal Libraries

  • will perform the following operations:
    • download Maven and Maven Wrapper to a temporary directory,
    • run Maven Wrapper to download Graal Libraries to the JS7 Agent's <agent-home>/lib/user_lib directory or to a .tar.gz archive.
  • is available for the following platforms:
    • Unix OS including Linux, MacOS, AIX using bash, ksh, zsh, dash Shell

For details about dependency setup see https://www.graalvm.org/jdk25/reference-manual/embed-languages.

Download Graal Libraries

The download script for Graal Libraries is provided for adding Polyglot and Graal Compiler .jar files to the JS7 Agent.

Download

Usage

Invoking the Download Graal Libraries Script without arguments displays the usage clause:

Usage
Usage: download-graal-libs.sh [Options] [Switches]

  Options:
    --agent-home=<path>                | optional: Agent home directory 
    --archive=<path>                   | optional: path to .tar.gz archive file for Graal Libraries
    --graalvm-version=<version>        | optional: GraalVM version such as 25.0.0, default: latest
    --maven-version=<version>          | optional: Maven version such as 3.9.11, default: 3.9.11
    --maven-wrapper-version=<version>  | optional: Maven Wrapper version such as 3.3.4, default: latest
    --temp-dir=<path>                  | optional: Temporary directory for Maven files, default: /tmp
    --java-home=<directory>            | optional: Java Home directory

  Switches:
   -h | --help                         | displays usage

Options

  • --agent-home
    • Specifies the JS7 Agent's home directory if the script is executed on the machine that holds the JS7 Agent.
    • Polyglot and Graal Compiler .jar files will be copied to the <agent-home>/lib/user_lib directory.
    • One of the --archive or --agent-home options must be specified.
  • --archive
    • Specifies the path to a .tar.gz archive to which Polyglot and Graal Compiler .jar files will be added.
    • Users can transfer the archive to a machine without internet access on which a JS7 Agent is operated and can extract the archive.
    • One of the --archive or --agent-home options must be specified.
  • --graalvm-version
    • Specifies the GraalVM version. GraalVM LTS versions should be used. 
    • If not specified, then the latest GraalVM version will be used.
  • --maven-version
    • Specifies the version of Maven that is used to run the Maven Wrapper.
  • --maven-wrapper-version
    • Specifies the version of Maven Wrapper that is used to download Graal Libraries.
    •  If not specified, then the latest Maven Wrapper version will be used.
  • --temp-dir
    • The script will create a sub-directory in the temporary directory for download of Maven and Maven Wrapper files. The directory defaults to /tmp. The sub-directory will be removed on script termination.
    • Should the OS be configured to deny script execution from the /tmp directory, then users should specify an existing directory that allows execution of scripts.
  • --java-home
    • Specifies the location of Java. The expected value is the Java home directory, i.e. the directory that contains the ./bin/java executable.
    • Any Java version starting from Java 1.8 can be used. The Java version is related to Maven, not to the Java version used by the JS7 Agent at run-time.
    • If the JAVA_HOME environment variable is set or if the java executable can be found, they will be used by default.

Switches

  • -h | --help
    • Displays usage.

Examples

The following examples illustrate typical use cases.

Add or Update Graal Libraries to Agent

Example for Adding/Updating Graal Libraries to Agent
# download the Download Graal Libraries Script
curl 'https://download.sos-berlin.com/JobScheduler.2.8/download-graal-libs.sh' -O

# make script executable
chmod +x download-graal-libs.sh

# run script for latest GraalVM version and copy .jar files to local Agent
./download-graal-libs.sh --agent-home=/opt/sos-berlin.com/js7/agent

Add or Update Graal Libraries from specific version to Agent 

Example for Adding/Updating Polyglot and Graal Compiler from a specific version of GraalVM to the Agent
# download the Download Graal Libraries Script
curl 'https://download.sos-berlin.com/JobScheduler.2.8/download-graal-libs.sh' -O

# make script executable
chmod +x download-graal-libs.sh

 # run script for specific GraalVM version and copy .jar files to local Agent
./download-graal-libs.sh --graalvm-version=25.0.1 \
                         --agent-home=/opt/sos-berlin.com/js7/agent \
                         --java-home=/usr/lib/jvm/java-17

Add or Update Graal Libraries from .tar.gz Archive to remote Agent

Example for Adding/Updating Graal Libraries from a .tar.gz Archive to a remote Agent
# download the Download Graal Libraries Script
curl 'https://download.sos-berlin.com/JobScheduler.2.8/download-graal-libs.sh' -O

# make script executable
chmod +x download-graal-libs.sh

# run script for latest GraalVM version and add .jar files to .tar.gz archive
./download-graal-libs.sh --archive=/tmp/graal-libs.tar.gz

# transfer Graal Libraries to Agent machine without internet access
scp /tmp/graal-libs.tar.gz sos@some_host:/tmp/

# extract Graal Libraries on Agent machine without internet access
ssh sos@some_host <<- EOF
    # remove existing version of Graal Libraries
    if [ -f "/opt/sos-berlin.com/js7/agent/lib/user_lib/.graal-libs ]; then
        while read -r file; do
            rm -f "/opt/sos-berlin.com/js7/agent/lib/user_lib/"${file}"
        done </opt/sos-berlin.com/js7/agent/lib/user_lib/.graal-libs
    fi

    # extract Graal Libraries to Agent directory for user .jar files
    tar -xzf /tmp/graal-libs.tar.gz -C /opt/sos-berlin.com/js7/agent/lib/user_lib 
EOF

Resources