Install Java

Check Java is working

Open a terminal and run the command

java -version

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

Java version

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

sudo apt install openjdk-17-jdk

openjdk-17 not available or not the right version?

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

sudo add-apt-repository ppa:openjdk-r/ppa
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

sudo update-alternatives --config java

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

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

brew cask install adoptopenjdk17

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

/usr/libexec/java_home -V

Switch to Java version 17

export JAVA_HOME=$(/usr/libexec/java_home -v 17)

Chocolatey is a package manager for Windows (similar to Homebrew for MacOSX)

Install the Java Runtime (JRE) using the following commands in a command window

choco install javaruntime

Download OpenJDK 11 Hotspot

Adopt OpenJDK webpage

Run the file once downloaded and follow the install instructions.

results matching ""

    No results matching ""