Install JDK 17
Download the JDK tar archive from here / https://wiki.openjdk.org/ OR here.
Steps for Linux/macOS:
- Store the extracted files in the Directory Tree:
Then, extract the compressed file appropriate to your OS. In case you can't or don't want to use admin permissions, extract it somewhere in your user space (like ~/.openjdk
).
If you want a more conventional location, extract it to /usr/local/
, which is where software manually installed by the user conventionally goes in POSIX systems.
azureuser@kafka-vm1:~$ wget https://aka.ms/download-jdk/microsoft-jdk-17.0.7-linux-x64.tar.gz
azureuser@kafka-vm1:~$ tar xfz microsoft-jdk-17.0.7-linux-x64.tar.gz
azureuser@kafka-vm1:~$ sudo su
root@kafka-vm1:/# ls
jdk-17.0.7+7 microsoft-jdk-17.0.7-linux-x64.tar.gz wget-log wget-log.1
root@kafka-vm1:/# mv jdk-17.0.7+7 /usr/local/
2. Set JAVA_HOME and add it to PATH:
Set JAVA_HOME to where you extracted your OpenJDK installation. Point it to the OpenJDK directory, not to its /bin
subfolder, as JAVA_HOME will not only be used to determine the executables' location.
This should be located in your shell initialization file. For example, let's suppose These are the two last lines of my ~/.bashrc
file for root user:
export JAVA_HOME="/usr/local/jdk-17.0.7+7/"
export PATH="$JAVA_HOME/bin:$PATH"
3. Verify Installation
Now, refresh your shell by either sourcing the init file or opening another tab/window.
You can check installation with java -version
.
# java -version
openjdk version "17.0.7" 2023-04-18 LTS
OpenJDK Runtime Environment Microsoft-7626293 (build 17.0.7+7-LTS)
OpenJDK 64-Bit Server VM Microsoft-7626293 (build 17.0.7+7-LTS, mixed mode, sharing)