Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to install java on my debian machine, and have found several how to's but

sudo apt-get install java-package

gives me "Couldn't find package java-package". Do I need to add a repository in my /etc/apt/sources.list file? Here are the current repos i have.

tone@homeserver:/etc/apt$ cat /etc/apt/sources.list
# deb cdrom:[Debian GNU/Linux 5.0.4 _Lenny_ - Official amd64 CD Binary-1 20100131-21:33]/ lenny main

deb cdrom:[Debian GNU/Linux 5.0.4 _Lenny_ - Official amd64 CD Binary-1 20100131-21:33]/ lenny main

deb lenny main
deb-src lenny main

deb lenny/updates main
deb-src lenny/updates main

deb lenny/volatile main
deb-src lenny/volatile main
share|improve this question
up vote 1 down vote accepted

You need to add contrib to your package list. So:

deb lenny main contrib
deb-src lenny main contrib
share|improve this answer
Hmm... I added those and double checked spelling, etc but still get same message – Tone Jul 22 '10 at 12:30
Did you run apt-get update after adding it? says it's part of contrib, so it should do it. – user4253 Jul 22 '10 at 15:39
yup that did it! thanks! – Tone Jul 22 '10 at 16:53

The packages for sun jdk/jre on debian are named sun-java$version-*, if you want to install the sun java 5 jre then its sun-java5-jre that will install the necessary packages.

You can find packages for debian usint their package search site that helps a lot.

EDIT: also, if you search the site I linked above you will see that sun-java packages are on the non-free suite, and you need to add then to your apt sources file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.