...
Step | Action | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1) Update and Upgrade OS |
Warning | ||
---|---|---|
| ||
The current version of java-8 may vary. Please adapt the following settings to the current version |
Code Block | ||
---|---|---|
| ||
sudo apt update sudo apt upgrade sudo reboot -p -f |
download Oracle JDK (Example filename jdk-8u241-linux-x64.tar.gz) and upload the file /opt/Download
2) Creating workspace
Code Block | ||
---|---|---|
| ||
sudo mkdir /usr/lib/jvm |
3) Extracting JDK
Code Block | ||
---|---|---|
| ||
cd /usr/lib/jvm sudo tar xzf /opt/Download/jdk-8u241-linux-x64.tar.gz sudo ln -s jdk1.8.0_241 current sudo chown -R root:root jdk1.8.0_241 |
3) Setting up environment variables
Code Block | ||
---|---|---|
| ||
sudo vi /etc/environment |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/current/bin:/usr/lib/jvm/current/db/bin:/usr/lib/jvm/current/jre/bin" J2SDKDIR="/usr/lib/jvm/current" J2REDIR="/usr/lib/jvm/current/jre" JAVA_HOME="/usr/lib/jvm/current" |
5) Configuring the Java location
Enter the following commands to inform the system of the Java location.
Code Block | ||||
---|---|---|---|---|
| ||||
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/current/bin/java" 0 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/current/bin/javac" 0 sudo update-alternatives --set java /usr/lib/jvm/current/bin/java sudo update-alternatives --set javac /usr/lib/jvm/current/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.
Code Block | ||||
---|---|---|---|---|
| ||||
update-alternatives --list java update-alternatives --list javac |
7) Validate
Restart
Test the installation
Code Block | ||
---|---|---|
| ||
java -version java version "1.8.0_241" Java(TM) -versionSE Runtime Environment (build 1.8.0_241-b07) Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode) sudo reboot -f |
2- Installing Maven
...