Debian – JDK Not installing in Debian.

debianinstallationjava

I am using these commands to install JDK/JVM in Debian server:

apt-get install openjdk-jdk
apt-get install sun-java6-jdk

But getting lots of error:

 404 Not Found [IP: 149.20.20.6 80]
 404 Not Found [IP: 199.6.12.70 80]

I trying to install this by:

apt-cache search jdk
apt-get install sun-java6-jdk sun-java6-jre

But here also showing same problem.

Does anyone know what can be causing this problem?

Best Answer

make sure you have run apt-get update before anything else.

The package name you likely want is openjdk-6-jdk or openjdk-6-jre (depending on if you are compiling java or just running java.

Debian is no longer distributing sun-* java packages, as oracle has changed the distribution license in a way which makes it illegal for us to do so.

If this is still not working, please show us the output of apt-cache policy openjdk-6-jre

Another possibility is that you are running a no longer supported release of Debian, like lenny (5.0) or etch (4.0), which are no longer on the regular Debian mirrors, but on http://archive.debian.org. Those would have out-dated, security-vulnerable versions of the sun java packages. However, if this is the case, I'd expect the apt-get update command to also give 404 errors. And if this is your situation, my recommendation is to first upgrade to a currently supported release of Debian.

EDIT:

You comment confirms that you are running an outdated version of debian which is no longer supported and no longer carried on the main mirrors. Lenny has been moved to the archive mirror on http://archive.debian.org/ On this archive, you will find old, known to be security-vulnerable versions of the JDKs. You could install these after changing to use the archive mirror, but my strong recommendation is to upgrade to the currently supported release by following the instructions in the chapter 4 of the squeeze release notes