I have used Ubuntu in my case but you can use this tutorial to install Java on other Linux distros like Fedora, openSUSE etc.
- Visit Java downloads page here.
- Download the required version of Java(I recommend to download the version with .tar.gz extension. Filename like jdk-8u77-linux-x64.tar.gz)
- Extract the archive to your required location. (I have it in my home folder and folder name is jdk1.8.0_77)
Now that you have downloaded and extracted the file, lets set our environment variables and start using java.
To set your environment variables:
1)open your bashrc file .
run command gedit ~/.bashrc from terminal to edit bashrc file
2)Now add these lines in .bashrc file.
export JAVA_HOME=full path to your java directory(mine would be ~/jdk1.8.0_77)
and save the file.
3)run command source ~/.bashrc from terminal
4)run command java -version to see if you have successfully installed java.
Please leave comments if you are having trouble installing Java.
Thanks for visiting my blog….cheers 🙂