You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Installing Java-8

Ref: install-oracle-jdk-in-ubuntu

StepAction

1) Update and Upgrade OS
and get Oracle JDK

Java version

The current version of java-8 may vary. Please adapt the following settings to the current version

sudo apt upgrade
sudo apt update
sudo reboot -p -f

download Oracle JDK  (Example filename jdk-8u241-linux-x64.tar.gz) and upload the file /opt/Download

2) Creating workspace

sudo mkdir /usr/lib/jvm

3) Extracting JDK

cd /usr/lib/jvm
sudo tar xzf /opt/Download/jdk-8u241-linux-x64.tar.gz
sudo chown -R root:root jdk1.8.0_241

3) Setting up environment variables


sudo vi /etc/environment
/etc/environnement
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/jdk1.8.0_241/bin:/usr/lib/jvm/jdk1.8.0_241/db/bin:/usr/lib/jvm/jdk1.8.0_241/jre/bin"
J2SDKDIR="/usr/lib/jvm/jdk1.8.0_241"
J2REDIR="/usr/lib/jvm/jdk1.8.0_241/jre"
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_241"

5) Configuring the Java location

Enter the following commands to inform the system of the Java location.

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_241/bin/java" 0
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_241/bin/javac" 0
sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_241/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0_241/bin/javac

6) To check the setup,

enter the following commands and make sure they indicate the location of java and javac as shown in the previous step.


update-alternatives --list java
update-alternatives --list javac

7) Validate

Restart

Test the installation

java -version
java -version
sudo reboot -f

2- Installing Maven

  • No labels