Question: how to install java 8 on ubuntu server?
Answer: Check which version of the JDK your system is using: java -version. ... 
Update the repositories: sudo apt-get update.
Install OpenJDK: sudo apt-get install openjdk-8-jdk. ... 
Verify the version of the JDK: ... 
If the correct version of Java is not being used, use the alternatives command to switch it: ... 
Verify the version of the JDK: