Automation Blog

from Stefan Schnell

The JavaScript Runtime Environment (RTE) from VCF Automation contains a combination of various specific components. The JavaScript RTE is built on VMware Photon OS, using Bellsoft Java JDK and the Rhino JavaScript engine. Building on that is the Dunes Framework with its objects. This post describes how to build a container that closely follows this approach, to provide an environment for development and testing.

Build Container with Equivalent JavaScript Runtime Environment

This post explains how to build a container using Podman in the Windows Subsystem for Linux (WSL). This requires that WSL and Podman are already installed.
And it is necessary to start podman on Windows first with the command podman machine start.
It is also necessary to stop Podman again at the end with podman machine stop, that should not be forgotten.

Build Photon OS Container

Hint: For the following step is an internet connection necessary.

Download the latest Photon OS release with the command
podman pull docker.io/library/photon:latest

Now it is necessary to start and connect to the container in interactive mode with
podman run -it --name photon5 photon

There is no editor available in Photon, so it is necessary to install one with
tdnf install nano

history -c clears the input history and exit leaves the interactive mode.

The following command sequence save the changes, the container as an archive and Podman is being reset.
podman commit photon5 photon
podman save -o photon5.tar photon
podman system prune --all --force
podman system df
With these steps a Photon OS container is available, which will serve as the base for our next steps.

Build Rhino JavaScript Container

Install Bellsoft JDK

Load Photon OS 5 container image from archive file with
podman load -i photon5.tar

Start and connect the container in interactive mode with
podman run -it --name photon photon

Download Bellsoft Liberica JDK 17, copy and unpack it in the container.
podman cp bellsoft-jdk17.0.19+11-linux-amd64-lite.tar.gz ^
  photon:/tmp/bellsoft-jdk17.0.19+11-linux-amd64-lite.tar.gz
podman exec photon mkdir -p /home/root
podman exec photon tar xvf /tmp/bellsoft-jdk17.0.19+11-linux-amd64-lite.tar.gz ^
  -C /home/root
podman exec photon rm /tmp/bellsoft-jdk17.0.19+11-linux-amd64-lite.tar.gz

Install Rhino JavaScript Engine

Download the Rhino JavaScript engine 1.7.15.1 and copy it in the container.
Hint: If you are using VMware Aria Automation release 8.18 or earlier, it is also possible to use the release 1.7R4 of the Rhino JavaScript engine, the procedure is the same.
podman exec photon mkdir -p /home/root/libs
podman cp rhino-1.7.15.1.jar photon:/home/root/libs/rhino-1.7.15.1.jar

Customize Configuration

Create and edit the file .bashrc in the home directory with
nano ~/.bashrc

Add the environment variables
export JAVA_HOME=/home/root/jdk-17.0.19-lite
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=".:/home/root/libs/rhino-1.7.15.1.jar"
Save and exit the nano editor with Strg+O (write out) and Strg+X (exit).

Test the Installation

To apply the changes immediately (without restarting), it is necessary to reload the file .bashrc with
source ~/.bashrc

Get the Java version with
java --version

It should deliver
openjdk 17.0.19 2026-04-21 LTS
OpenJDK Runtime Environment (build 17.0.19+11-LTS)
OpenJDK 64-Bit Server VM (build 17.0.19+11-LTS, mixed mode)

Try a command with the Rhino shell
java org.mozilla.javascript.tools.shell.Main -e "print('Hello World');

It should deliver
Hello World

Complete the Installation

history -c clears the input history and exit leaves the interactive mode.

The following command sequence save the changes, the container as an archive and Podman is reset.
podman commit photon photon_rhino
podman save -o photon5_rhino1.7.15.1.tar photon_rhino
podman system prune --all --force
podman system df
With these steps a Photon OS container with a JDK and the Rhino JavaScript engine is available, which will serve as the base for our next steps.

Build VCF Equivalent Container

Load Rhino JavaScript container image from archive file with
podman load -i photon5_rhino1.7.15.1.tar

Start and connect the container in interactive mode with
podman run -it --name photon_rhino photon_rhino

Create directories in the container
podman exec photon_rhino mkdir -p /opt/rhino/lib
podman exec photon_rhino mkdir -p /opt/rhino/scripts

Download the emulation libraries and copy it in the container
podman cp assert.class.js photon_rhino:/opt/rhino/lib/assert.class.js
podman cp byteBuffer.class.js photon_rhino:/opt/rhino/lib/byteBuffer.class.js
podman cp command.class.js photon_rhino:/opt/rhino/lib/command.class.js
podman cp file.class.js photon_rhino:/opt/rhino/lib/file.class.js
podman cp mimeAttachment.class.js ^
  photon_rhino:/opt/rhino/lib/mimeAttachment.class.js
podman cp system.class.js photon_rhino:/opt/rhino/lib/system.class.js
podman cp url.class.js photon_rhino:/opt/rhino/lib/url.class.js
podman cp zip.class.js photon_rhino:/opt/rhino/lib/zip.class.js

To test the installation, a tiny JavaScript hello world program is build with the nano editor.
cd /opt/rhino/scripts
nano helloWorld.js

load("/opt/rhino/lib/system.class.js");

function main() {
  System.log("Hello World");
}

main();

It is executed with
java org.mozilla.javascript.tools.shell.Main helloWorld.js

It should deliver
INFO Hello World

Addendum

Change the directory with
cd /usr/local/bin

Create and edit a shell skript with the name rhino
nano rhino

Add the code to call Rhino JavaScript engine
#!/bin/bash
java org.mozilla.javascript.tools.shell.Main -opt -1 -version 200 -f "$1"
Save and exit the nano editor with Strg+O (write out) and Strg+X (exit).

Make the shell script executable
chmod +x rhino

With these steps it is possible to call a Rhino JavaScript file with the rhino shell script, e.g.
rhino /opt/rhino/scripts/helloWorld.js

Complete the Installation

history -c clears the input history and exit leaves the interactive mode.

The following command sequence save the changes, the container as an archive and Podman is reset.
podman commit photon_rhino vcf_js
podman save -o vcf_javaccript.tar vcf_js
podman system prune --all --force
podman system df
With these steps a container with an equivalent VCF JavaScript RTE is available.

Use VCF Equivalent Container

Load VCF equivalent container image from archive file with
podman load -i vcf_javaccript.tar

Start and connect the container in interactive mode with
podman run -it --name vcf_js vcf_js

Execute a script file with
java org.mozilla.javascript.tools.shell.Main -opt -1 -version 200 -f yourScript.js
or
rhino yourScript.js

container with vcf equivalent javascript runtime environment in interactive mode
container with vcf equivalent javascript runtime environment in interactive mode

Conclusion

This is an approach that can certainly be improved. But it has become visible, that with just a few commands it is possible to build a container that is nearly equivalent to the VCF Automation JavaScript runtime environment. Some of the functions of Dunes objects are emulated, with the exception of specific Orchestrator commands. The operating system, the JDK, the Rhino Engine and the emulation libraries allow to replicate the real-world environment very closely. This makes it possible to determine whether approaches works in principle, which simplifies development and testing to shorten the development time.