Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

So I just rented a dedicated server running Debian, and I know nothing about Linux.

Anyway, I want to install the JDK 7, first I connected through SSH and granted myself administrator rights by typing su -.

Then I typed apt-get install openjdk-7-jdk, however I get a message saying that the package openjdk-7-jdk cannot be found

Am I doing something wrong?

share|improve this question
try this. run apt-get update and then run the same command again. –  harish.venkat Dec 19 '12 at 17:54
Which version of debian is this? If it is old, there may not be an openjdk 7 compiled against it, so you won't find one -- although this seems unlikely. In any case, you should be able to use the Oracle JDK 7 for linux, just find the link then use wget via ssh. –  TAFKA 'goldilocks' Dec 19 '12 at 19:15
debian v6.0.0 (64BITS) –  Eildosa Dec 19 '12 at 21:36
add comment

2 Answers

The packages available for installation as well as already installed ones can be listed with the command

apt-cache --names-only search openjdk

The first column is the package name which is to be provided as argument for apt-get install. For example:

apt-get install openjdk-7-jdk openjdk-7-doc openjdk-7-jre-lib
share|improve this answer
Sure. But how does this answer the question? The OP has the correct package name already. –  ire_and_curses Dec 19 '12 at 17:57
Who filled this cache with sofware to install? how can I add some to it? apparently the JDK7 is not in it. –  Eildosa Dec 19 '12 at 18:09
please show the output of apt-cache -n search openjdk –  harish.venkat Dec 19 '12 at 18:11
openjdk-6-dbg - Java runtime based on OpenJDK (debugging symbols) openjdk-6-demo - Java runtime based on OpenJDK (demos and examples) openjdk-6-doc - OpenJDK Development Kit (JDK) documentation openjdk-6-jdk - OpenJDK Development Kit (JDK) openjdk-6-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless) openjdk-6-jre-lib - OpenJDK Java runtime (architecture independent libraries) openjdk-6-jre - OpenJDK Java runtime, using Hotspot JIT openjdk-6-source - OpenJDK Development Kit (JDK) source files openjdk-6-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark –  Eildosa Dec 19 '12 at 18:16
if you want openjdk-7 use add-apt-repository ppa:openjdk/ppa and then apt-get update and then apt-get install openjdk-7-jdk openjdk-7-doc openjdk-7-jre-lib –  harish.venkat Dec 19 '12 at 18:18
show 3 more comments

Debian squeeze apparently does not include OpenJDK 7 yet.

Availability of OpenJDK 7 in Debian: http://packages.debian.org/search?keywords=openjdk-7-jdk

As you might know, early version of Java 7 had a number of issues. Ranging from excessive memory use with AWT to security issues (ok, IIRC these also affected Java 6). So, at the time Debian squeeze was released, OpenJDK 7 was not ready to be used (not yet "stable").

So you have three options:

  • Upgrade to the next version, wheezy
  • Try to build the openjdk-7 package from wheezy on squeeze (should work, but it is not on backports yet!)
  • Manually install openjdk-7

The first option has one big big big advantage: you get automatic security updates. And if you need more up to date software than is in current stable, you may have to use the next-stable version.

With the second option, you should at least have an easy way of making Java 7 your default java. With the unmanaged installation (option 3) this is much more tricky to get working reliably.

Anyway, I would go with the first option.

share|improve this answer
wheezy does not include openjdk-7 too. –  Majid Azimi Feb 25 '13 at 6:29
@MajidAzimi sure it does: packages.debian.org/wheezy/openjdk-7-jdk - you should however make sure to get version 7u3-2.1.6-1 which includes the recent security fixes. –  Anony-Mousse Feb 25 '13 at 8:10
add comment

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.