Ballerina, Software Development

Run Ballerina On Command-Line Without Installing Java

Ballerina Programming Language
Ballerina Programming Language

This post shows how to run Ballerina On Command-Line without installing the Java Development Kit (JDK) in Windows 10 64-bit. Instead, we use a zip distribution of Java with only two environment variables. This distribution of Java is self-contained that we install anywhere on a local disk where we have permission to write. We download the zip file and extract it to a directory.

Set-up Java Without Installing

First, download an OpenJDK and extract it to some directory. Choose OpenJDK 8 (LTS), click the Other platforms button.

Run Ballerina Without Installing Java

Then, scroll the page down until we see the JDK zip distribution for Windows 64-bit (x64). Then, click the .zip button.

Run Ballerina Without Installing Java

Finally, extract the zip file we downloaded.

Run Ballerina Without Installing Java

 

Run Ballerina Without Installing Java

Go inside the directory and copy the current path. We will use that path to set some environment variables.

Run Ballerina Without Installing Java

For this post, we have the path C:\Users\karldev\Downloads\OpenJDK8U-jdk_x64_windows_hotspot_8u265b01\jdk8u265-b01.

Download Ballerina Zip Distribution

Now, we download the Ballerina zip distribution. Go to Ballerina Download page, click the “Install via the ZIP archive” link which brings us to another page. Then, click Download the Ballerina language ZIP file link.

Run Ballerina Without Installing Java

Go to the directory and copy the current path for later use.

Run Ballerina Without Installing Java

For this post, we have C:\Users\karldev\Downloads\ballerina-1.2.7.

Run Ballerina On Command Line

Open a command-line window, and run the following MS-DOS commands. The first two commands set up environment variables JAVA_HOME and PATH to make Java available in the command-line window.

Then, verify if Java is now available.

We should see the following output.

javac 1.8.0_265

Next, we make Ballerina available in the command-line windows.

When we try to run Ballerina at this point and we encounter the following error, we need to include the  C:\Windows\System32 path in the PATH environment variables.

To fix this, run the following command.

Now, we can run Ballerina.

Run Ballerina

That’s how we can run Ballerina on command-line without installing Java. If we need to do the same for the Ballerina IntelliJ plugin, please see IntelliJ IDEA And Ballerina Plugin Configuration.

This is part of the Ballerina Programming Language Tutorial.

You Might Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *