If you want to run a Java app on a fresh Ubuntu server, (say Minecraft) then you first need to install the appropriate Java runtime. You can do this as follows:
Update the apt repository with the following command:
sudo apt-get update
Then check if Java is already installed:
java -version
Install the Java Runtime Environment with the following command:
sudo apt-get install default-jre
And for the Java Development Kit, use this:
