0

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 http://packages.debian.org/sid/sun-java6-jdk.

1
  • An error message would help in this case.
    – tshepang
    May 26, 2011 at 13:01

4 Answers 4

2

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.

2

Update: I would probably use one of the JDK 6 builds from https://www.azul.com/downloads/zulu/zulu-linux/ now. Azul runs tests to make make sure the OpenJDK build is compliant, and also offers commercial support

Assuming Debian means Debian Jessie.

I used the tool https://wiki.debian.org/JavaPackage to create a deb from the legacy JDK 6 provided by Oracle for the purposes of debugging older systems.

Steps

  1. Download the JDK 6 from http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html. You will need an Oracle user account.
  2. Install java-package from contrib. (Add contrib to your /etc/apt/sources.list if necessary)

    deb http://httpredir.debian.org/debian jessie main contrib
    deb-src http://httpredir.debian.org/debian jessie main contrib
    
    deb http://security.debian.org/ jessie/updates main contrib
    deb-src http://security.debian.org/ 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.
1

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.

-1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .