Last active
January 28, 2022 22:00
-
-
Save espacioAntonio/cd168355bd2575a79561f9c52ee08d73 to your computer and use it in GitHub Desktop.
How to install Java JDK on Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################## | |
# Download JDK | |
# http://www.oracle.com/technetwork/java/javase/downloads/index.html | |
######################################################################## | |
# EXAMPLE JDK 8u152 version | |
tar xvzf jdk-8u152-linux-x64.tar.gz | |
# Move directory created to /opt | |
sudo mv jdk1.8.0_152 /opt/jdk | |
# Set variables | |
sudo cp --backup=t /etc/environment /etc/environment.bak | |
echo 'JAVA_HOME="/opt/jdk"' | sudo tee -a /etc/environment | |
echo 'export J2SDKDIR=/opt/jdk | |
export J2REDIR=/opt/jdk/jre | |
export PATH=$PATH:/opt/jdk/bin:/opt/jdk/db/bin:/opt/jdk/jre/bin | |
export JAVA_HOME=/opt/jdk | |
export DERBY_HOME=/opt/jdk/db | |
' | sudo tee /etc/profile.d/jdk.sh | |
############################################### | |
# NOW RESTART YOUR SESSION (Logout and Login) # | |
############################################### | |
java --version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment