Installing Java

A guide about how to install OpenJDK or Oracle JDK

May 20th, 2020


Recommended versions of Java

We recommend installing a full Java JDK, while Mango should work with just a JRE we sometimes depend on tools only available in the JDK for our scripts and for providing support.

  • For Mango versions 3.6.x and higher we recommend using the latest version of Adopt OpenJDK.
  • For Mango versions 3.5.x and lower you should use JDK 8 (OpenJDK 8 should work however we primarily tested on Oracle JDK). Older versions of Mango may not work correctly if you use a newer JDK.
  • OpenJDK 8 builds for ARM 32 processors seem to perform extremely poorly, we suggest avoiding this JDK

Installing OpenJDK

OpenJDK is a free and open source version of the Java JDK. AdoptOpenJDK provies pre-built OpenJDK binaries for a variety of operating systems and architectures.

  1. Visit Adopt Open JDK
  2. Choose the JDK version you wish to install
  3. Select HotSpot JVM
  4. Choose your operating system and architecture
  5. Download the archive or installer (for Windows or Mac). If you download the installer see the installation for further instructions
  6. Extract the archive to your chosen location on your filesystem (e.g. /opt/openjdk)
  7. Set the JAVA_HOME environment variable to point to your installation directory
  8. You may also want to add the bin directory to your path by appending $JAVA_HOME/bin to your PATH environment variable

Installing Oracle JDK 8

Important: Oracle has changed their license and the Oracle JDK is no longer free for commercial use. Please see Oracle’s FAQ about the license change.

You can download Oracle JDK 8 from this link, you must accept Oracle’s license agreement to use this JDK.

  1. Visit Oracle JDK 8
  2. Read and accept the Oracle License Agreement for the latest version of the Java SE Development Kit
  3. Download the appropriate file for your architecture and operating system
  4. Extract the archive to your chosen location on your filesystem (e.g. /opt/openjdk)
  5. Set the JAVA_HOME environment variable to point to your installation directory
  6. You may also want to add the bin directory to your path by appending $JAVA_HOME/bin to your PATH environment variable

Setting your JAVA_HOME environment variable

Linux

Edit your /etc/environment file and add a line like JAVA_HOME=/opt/openjdk (Press Ctrl-X to exit, it will prompt to save)

sudo nano /etc/environment

Or a simple one line command:

sudo sh -c 'echo JAVA_HOME=/opt/openjdk >> /etc/environment'

Windows

  • Open “System Properties”, on Windows 10 you can search for “Environment Variables”
  • Click “Environment Variables”
  • Under “System variables” click “New”
  • Enter JAVA_HOME as the variable name and your JDK installation path under variable value
  • Press “OK” twice
sudo nano /etc/environment

env vars Windows

Copyright © 2020 Radix IoT, LLC.