Linux – How to ACTUALLY install Java on Linux

javalinuxUbuntu

I have a Ubuntu Server.

From the terminal, how should I install JDK?

In this guide it says to use this command:

sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk

But on Suns website, it says JDK includes the JRE, so why the JRE in the line above?

Anybody know how to actually install Java?

Every guide and every forum shows different ways of doing it.

BTW: It is a VPS (virtual private server)

Best Answer

Use apt-get install sun-java6-jre sun-java6-jdk. Just because Oracle's (Sun's) JDK distribution also contains a JRE does not necessarily mean that the Ubuntu team packaged it the same way.

Of course, if you do not want to develop Java applications on your server but only want to run them, sun-java6-jre should be enough.