Installing Java on Ubuntu?

I got a VPS and I’m trying to install Java but apt-get is being a bastard. It also couldn’t find zip, by the way.


apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

E: Couldn’t find package sun-java6-jre


add-apt-repository "deb http://archive.canonical.com/ lucid partner"

add-apt-repository: command not found

How are you all doing? I’m doing everything through SSH.


apt-get update

There we go.

What version of Ubuntu are you using?
I think add-apt-repository only works with newer (>= 9.04?)

The Linode Library has great info for setting up a VPS:


If you use it and didn’t go with Linode, you should feel very, very dirty. :wink:

Given the line he was trying to add, I’d guess he’s using Lucid :wink: Aka 10.04.

Eli, just in case you would prefer OpenJDK to the version Snoracle allow to escape, it’s also available as openjdk-6-jdk.

@pjt33:
Not quite, the line he was trying to add is one thing. You can try that line on any machine, does not mean it will work. :wink:
Even more so as this line is shown on many help sites, but left up to the user to figure out if it will work on their OS or not.

@Openjdk
Depending on the version you installed, it might already be installed.
iirc the Desktop version comes with it.

Heck, in order to get the Snoracle (I like that one) you might just have to disable the openjdk one (see below).

A nice guide:
http://ubuntuforums.org/showthread.php?t=1517979

Can you use Synaptic to install Java?

@gouessej:
I would not know why not.
Most just use the cmd line as it is quicker.

Yeah, that line didn’t work. I just needed to update apt-get and then I did an install for jdk-latest or whatever the package was called. Works fine.