Hey Guys Its Nil and Welcome to HardCore Linux, In this Video I will give a demo on "How to install Orale Java 8 on Ubuntu 18.04 using terminal aka Manually"
So, lets get started...
Step 1: Download the latest JDK
Go to Official Web Site and Dowload It
Step 2: Extract JDK to Java's default location
Create a jvm folder in /usr/lib/ which is the default location for Java.
sudo mkdir /usr/lib/jvm
Go to the created /usr/lib/jvm folder.
cd /usr/lib/jvm
Extract the downloaded JDK.
sudo tar -xvzf ~/Downloads/jdk-8u151-linux-x64.tar.gz [Change It to Your Version ]
Step 3: Set environment variables
vi /etc/environment
The environment file should now be similar to this text: [Change It to Your Version ]
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk1.8.0_151/bin:/usr/lib/jvm/jdk1.8.0_151/db/bin:/usr/lib/jvm/jdk1.8.0_151/jre/bin"
J2SDKDIR="/usr/lib/jvm/jdk1.8.0_151"
J2REDIR="/usr/lib/jvm/jdk1.8.0_151/jre*
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_151"
DERBY_HOME="/usr/lib/jvm/jdk1.8.0_151/db"
Step 4: Inform Ubuntu about the installed location
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_151/bin/java" 0
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_151/bin/javac" 0
sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_151/bin/java
sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_151/bin/java
Step 5: Setup verification
Give the location of java and javac as you provided.
update-alternatives --list java
update-alternatives --list javac
Step 6: Verify the Java version
java -version
The output should resemble the following:
Java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
You should be able to see your installed java version which means you have successfully installed the Oracle JDK.
So That's it for This Video Guys, I hope you like it, if you do give this video a thumb's up, share and do Subscribe and all ways thanks a lot for watching Its Hcl
Good Night Guys.