When we first start development or setting a system for development one of the most important thing is to install oracle java. This can be achieved using Oracle PPA’s by using only 3 commands in
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer
But as a Java developer, it becomes also important to know how to install oracle java manually and what all it takes to get jdk to our system. Here I am compiling the steps required with the explanation on doing so to install jdk manually without using any PPA’s repository.
First we need to download the jdk form Oracle official site at here:
We need to Accept License Agreement to download the latest tar.gz package for Linux.
Then we need to open the terminal and navigate to /opt directory and make Java folder there with super user permission using command, and provide the password.
sudo mkdir java
Then we need to change the owner of the java folder as the current user using
sudo chown user:user java/
command. Note: user need to be the your own user-name with which you are logged in.
Then navigate to the Java folder and move the downloaded jdk package to the current location using
cp /home/user/Downloads/jdk-xxx-linux-x64.tar.gz .
Now we need to extract the jdk package using
tar zxvf jdk-xxx-linux-x64.tar.gz
command. and remove the jdk tar package using
rm -rf jdk-xxx-linux-x64.tar.gz
Now lets give the ownership of the extracted package to the current user using command.
chown -R user:user *
Now we can navigate inside the extracted jdk package and get the current path using command.
This is the path for the install Java package we need to copy this path as we would require to setup the JAVA_HOME property.
Now we need to create java.sh file in /opt/profile.d/ directory using
sudo gedit /opt/profile.d/java.sh
command. This will open the java.sh file in gedit. You can make use of some other text editor program.
In this java.sh file We need to define JAVA_HOME and PATH variables
export JAVA_HOME=PATH_COPIED_FROM_PWD_COMMAND export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
Now we need to update the java-alternatives to be used using
sudo update-alternatives --install /usr/bin/java java /opt/java/jdk.xxx/bin/java 3 sudo update-alternatives --config java
Then we can check if everything is working fine using
If you want to know how to setup the oracle jre in eclipse feel free to checkout here…
Hope this get you through and help you understand a bit more about the java and its development setup. Let me know in the comment section below if it was of any help. Thanks a lot for your time guys.