Sun Java and Debian 6 Squeeze —

Sun Java is available thru the Non-Free Repo for Squeeze, to add it you must add

deb squeeze main non-free
to your /etc/apt/sources.list file. If I’ve never been clear about how to do that you must open the file as sudo or root in any text editor.

Once this is done you update your apt with sudo apt-get update

Then essentially you type sudo apt-get install sun-java6-jdk for the Java Dev Kit or choose sun-java6-jre if you just want the JRE for the use of Java.. I tend to pick the JDK because a few apps like it over the JRE.

Note: You can test your Java version with java -version and if you don’t get a Sun Version of Java as a reply then you need to type this: sudo update-alternatives --config java and select the newly installed java which is something like…
There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
* 0 /usr/bin/gij-4.4 1044 auto mode
1 /usr/bin/gij-4.4 1044 manual mode
2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode

and in my case I chose # 2

You should be good to go now.. keep in mind this is just java.. if you want the plugin it’s sudo apt-get install sun-java6-plugin sun-java6-fonts


Categorised as: Geeking Out | Linux | Squeeze


  1. […] I wrote up a document on installing Java on Debian 6 here. […]

  2. Guy says:

    Many Thanks 🙂

  3. […] 1. add this to your /etc/apt/sources.list file: deb squeeze main non-free 2. Update your apt with: sudo apt-get update 3. You can test your Java version with: java -version 4. If you successfully got the Sun Java JRE (or OpenJDK JRE will also work), then get the plugin: sudo apt-get install sun-java6-plugin sun-java6-fonts 2. […]

  4. […] system I had both OpenJDK6 and Sun Java 6 loaded.  The recommendations that I read (including at this hyperlink) talked about how to remove Java 6 and install Java 7.  I did not really want to do that […]

  5. PatM says:

    Nice! Thanks for the writeup!

  6. Rajan says:

    I keep forgetting how to do this. Thanks a lot.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.