Java VM installation tutorial - Storm Streaming Server

If you wish to install Storm Streaming Server directly on your machine of VPS, a Java Virtual Machine (JVM) is required. This guide describes in detail how to download and configure Java on Linux, Windows and Mac OS. Once this part is done, please check our Native Installation Guide to see how to properly install and configure our server software.

In order to check whether your server comes with a pre-installed Java library, you can use the following command.

For Linux, Mac-OS X and Windows based systems (terminal/PowerShell)

                        
java -version
                    

In return, you should get something like this:

                        
java version "13.0.1" 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
                    

Installation of OpenJDK on Linux-based operating systems

For Debian-based Linux distribution (like Ubuntu, Mint)

                        
sudo apt-get update
sudo apt-get install java-1.8.0-openjdk
                    

For Fedora, Oracle, Red-Hat

                        
su -c "yum install java-1.8.0-openjdk"
                    

Certain versions of Debian, Fedora, etc. are limited to a specific version of Java. It is also possible to download the latest Java JRE on your own from https://jdk.java.net. Once the files are uploaded to your server, extract the package:

                        
tar xvf openjdk-<VERSION>_bin.tar.gz -C /usr/lib/jvm/java-<VERSION>
                    
Depending on your Linux distribution these paths might not be present on your system. Command mkdir and chown will allow you to create them.

Where <VERSION> is the actual version of the JVM, e.g., “16+36_linux-x64”. You’ll also have to add a reference to this Java version using:

                        
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-<VERSION> /bin/javac" 1
                    
As in previous note, depending on your Linux distribution these paths might not be present on your system.

followed by:

                        
sudo update-alternatives --config java
                    

At this point, you’ll be asked to select your default java configuration. Your newly installed JRE should appear as the last one on the list. Select the number next to the path to confirm your choice.

                        
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                      Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-6.31-oracle/bin/java     1062      auto mode
  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/java-6.31-oracle/bin/java     1062      manual mode

Press enter to keep the current choice[*], or type selection number:
                    

Installation of OpenJDK on Windows-based operating systems

Library files can be found on https://jdk.java.net. Once the package is downloaded, please extract it to C:\Program Files\Java\jdk-<VERSION>, where <VERSION> is the actual version of the library.

Now we’ll have to set the proper PATH for you Java. Select Control Panel and then System. Click Advanced and then Environment Variables and add the location of the bin folder of the JDK installation to the PATH variable in System Variables.

The following is a typical value for the PATH variable:

                        
C:\WINDOWS\system32;C:\WINDOWS;"C:\Program Files\Java\jdk-<VERSION>\bin"
                    

Now it’s time for JAVA_HOME variable. In the same window, under System Variables, click New. Enter the variable name as JAVA_HOME. Then enter the variable value as the installation path of the JDK (without the bin sub-folder).

JAVA_HOME C:\Program Files\Java\jdk-<VERSION>
Table 1. JAVA_HOME variable table

Click OK / Click Apply Changes

Installation of OpenJDK on Mac OS X operating systems

The installation of Oracle Java on Linux-based systems is very similar. Please download the latest JRE from https://www.oracle.com/pl/java/technologies/javase-downloads.html

Once the package is downloaded, please move it to a write-enabled directory. Now we’ll be able to use some commands.

                        
sudo apt install <PATH_TO_FILE>/jdk-<VERSION>_bin.deb
                    

The installer will ask several questions and ask you to accept the license. Once the process is finished, we must configure this JRE as the default one:

                        
sudo update-alternatives -install /usr/bin/java java /usr/lib/jvm/<VERSION> 1
                    

In case you already have a different version of java, so you can choose the right one with:

                        
sudo update-alternatives --config java
                    

Your newly installed JRE should appear as the last one on the list. Select the number next to the path to confirm your choice.

                        
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                      Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-6.31-oracle/bin/java     1062      auto mode
  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/java-6.31-oracle/bin/java     1062      manual mode

Press enter to keep the current choice[*], or type selection number:
                    

In order to check if everything is ok, please use the following command:

                        
sudo java -version
                    

If the output says that command was not found, there is one more command we need to do:

                        
export PATH=$PATH:/usr/lib/jvm/jdk-<VERSION>/bin
                    

Alternative Java VM

There are many implementations of Java VM. You may want to check ones provided by Oracle https://www.oracle.com/pl/java/technologies/javase-downloads.html or IBM https://www.ibm.com/support/pages/java-sdk-downloads-version-110 . Some of these might be easier to install due to included installers, however please make sure to check their licensing agreement to avoid legal issues.