-
Notifications
You must be signed in to change notification settings - Fork 541
Installing OpenJDK for Mac and Linux
Rishabh Poddar edited this page Apr 22, 2021
·
3 revisions
-
Download
OpenJDK 15.0.1
from here -
Create the /usr/java directory:
sudo mkdir /usr/java
-
Navigate to the directory where the archive was downloaded and move the archive to the new directory:
mv openjdk-15.0.1_linux-x64_bin.tar.gz /usr/java
-
Go to this directory:
cd /usr/java
-
Unpack archive:
sudo tar -xzvf openjdk-15.0.1_linux-x64_bin.tar.gz
-
Set the environment variables, for this open the
/etc/profile
file and add the text mentioned below to the end of the file:
JAVA_HOME=/usr/java/jdk-15.0.1
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
- Check Java version:
java -version
- Download
OpenJDK 15.0.1
from here - Navigate to the directory where the archive was downloaded and extract the file
tar -xzvf openjdk-15.0.1_osx-x64_bin.tar.gz
- Install the JDK
sudo mv jdk-15.0.1.jdk /Library/Java/JavaVirtualMachines/
- Check java version:
java -version
- In case you do not see
openjdk version "15.0.1"
, then you need to switch the default to that version. This stackoverflow answer will guide you.