Install Java

Before installing, check to see if there is an appropriate version of Java already installed.

Open a terminal and run the command

java -version

If Java is installed, you will see something like this in your terminal:

Java version

If the version is 11 or above, then jump to the Clojure install page

Operating System specific install instructions

For windows users, the scoop install is recommended.

{% tabs ubuntu=”Debian/Ubuntu”, homebrew=”Homebrew”, windows=”Windows”, manual=”Manual” %}

{% content “ubuntu” %}

Open a terminal and run the following command (you will be prompted for your login password to complete the install)

  1. sudo apt install openjdk-11-jdk

Hint:: openjdk-11 not available or not the right version?

If openjdk-11 is not available, add the Ubuntu OpenJDK personal package archive

  1. sudo add-apt-repository ppa:openjdk-r/ppa
  2. sudo apt-get update

Switching between Java versions If you have more than one version of Java installed, set the version by opening a terminal and using the following command

  1. sudo update-alternatives --config java

Available java versions will be listed. Enter the list number for the version you wish to use.

{% content “homebrew” %}

Using Homebrew, run the following command in a terminal to install Java 11:

  1. brew cask install adoptopenjdk11

Hint::Switching between Java versions

You can run more than one version of Java on MacOS. Set the Java version by opening a terminal and using one of the following commands

Show the Java versions installed

  1. /usr/libexec/java_home -V

Switch to Java version 11

  1. export JAVA_HOME=$(/usr/libexec/java_home -v 11)

{% content “windows” %} For Windows 10 use Windows Subsystem for Linux and Windows Terminal are recommended if you have administrative privileges and are happy to use a Unix system on the command line.

Alternatively use scoop.sh, a command line installer for windows. Powershell 5 or greater is required.

Follow the scoop-clojure install instructions, summarized here:

  1. scoop install git
  2. scoop bucket add java
  3. scoop bucket add scoop-clojure https://github.com/littleli/scoop-clojure
  4. scoop install adoptopenjdk-lts-hotspot

scoop can also be used to install clojure

Still having problems?

If neither Scoop or Windows Subsystem for Linux work, try the Chocolatey package manager. Install the Java Runtime (JRE) using the following command in a command line window

  1. choco install javaruntime

If Chocolatey does not work, then try the manual Java install.

{% content “manual” %}

Download OpenJDK 11 Hotspot

Adopt OpenJDK webpage

Run the file once downloaded and follow the install instructions.

{% endtabs %}