Hi,
Follow below article to install oracle java 8 in ubuntu server (desktop).
https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04
Installing Oracle JDK steps :
1) Install oracle PPA's and update package repository
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
2) Install oracle 8 java
$ sudo apt-get install oracle-java8-installer
3) Manage java (if there are multiple java installations are available, chose a one by typing below command)
sudo update-alternatives --config java
4) Configuring JAVA_HOME environment variable
Type below command to open environment file with nano editor
sudo nano /etc/environment
at the end of the file add below path
JAVA_HOME="/usr/lib/jvm/java-8-oracle"
Save the file and come back to command prompt and then issue below command to reload the environment variable.
source /etc/environment
check JAVA_HOME path at command by issuing below command
echo $JAVA_HOME
after issuing above command, you should get below path usr/lib/jvm/java-8-oracle
I hope this help you and for open jdk or other versions of java installation refer to the link
provided at the beginning of the post.
- Sadakar Pochampalli