Installing the Java JDK on Ubuntu
In this tutorial, I will be showing you can install the Java JDK on Ubuntu via the terminal. This should work on all versions of Ubuntu and any Debian based operating system. The first thing you will need to do is open the Terminal and switch to the root user. This will just save time and mean you dont have to keep sudo'ing.
Once you have the terminal open, type in the command below and then your password.
You should now be able to run the following commands without the need to sudo. Next, you must make sure everything is up to date. you can do so by typing
apt-get update; apt-get upgrade
Once everything has updated, you can now install the JDK.
apt-get install default-jdk
You can test to make sure the JDK has been installed by typing in javac in to the terminal.