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

If I try to install Sun Java JDK 6 on Debian, it doesn't install it. I don't want to install OpenJDK, because it doesn't work always exactly same as Sun JDK.

I use following command:

apt-get install sun-java6-jdk

Package name should be correct, see link

share|improve this question
An error message would help in this case. – Tshepang May 26 '11 at 13:01

Run sudo apt-cache search java6 to get a list of packages available from the default repositories. If you don't see anything you like, you will have to either add an apt repository or install java manually.

share|improve this answer

The Sun (well, Oracle) Java packages are in the non-free repository, which you may have disabled (not sure off the top of my head whether it's enabled by default in sid). Make sure non-free is enabled in your /etc/apt/sources.list, then run an apt-get update.

share|improve this answer

Assuming Debian means Debian Jessie.

I used the tool to create a deb from the legacy JDK 6 provided by Oracle for the purposes of debugging older systems.


  1. Download the JDK 6 from You will need an Oracle user account.
  2. Install java-package from contrib. (Add contrib to your /etc/apt/sources.list if necessary)

    deb jessie main contrib
    deb-src jessie main contrib
    deb jessie/updates main contrib
    deb-src jessie/updates main contrib
    $ sudo apt-get && sudo apt-get install java-package.
  3. Run make-jpkg on Oracle archive.

    make-jpkg /vagrant/jdk-6u45-linux-x64.bin
  4. Install package

    sudo dpkg -i oracle-java6-jdk_6u45_amd64.deb
  5. Make sure that JDK 6 is the default JDK if you have multiple.

    sudo update-alternatives --config javac
  6. Check that everything works.

     [09:00]  [alex@debian-jessie:~]  $ javac -version
     javac 1.6.0_45
     [09:00]  [alex@debian-jessie:~]  $ java -version
     java version "1.6.0_45"
     Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
     Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
     [09:01]  [alex@debian-jessie:~]  $ mvn -v
     Apache Maven 3.0.5
     Maven home: /usr/share/maven
     Java version: 1.6.0_45, vendor: Sun Microsystems Inc.
     Java home: /usr/lib/jvm/jdk-6-oracle-x64/jre
     Default locale: en_US, platform encoding: UTF-8
     OS name: "linux", version: "3.16.0-4-amd64", arch: "amd64", family: "unix"
  7. To also install JRE 6, follow steps 1-6.
share|improve this answer

Are you running as root? Otherwise you'd need to use sudo to elevate yourself to have sufficient privileges to make system wide installations.

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.