I have Ubuntu. I want to install the Sun JDK version 6 using the command line (apt-get). How do I do that. What is the name of the package?

Or is the open JDK version the only option.

  • Don't use OpenJDK at the moment for Swing applications. It will result in truncated controls, paint problems or other mysterious bugs.
    – Mike L.
    Sep 14, 2010 at 13:57

2 Answers 2


Assuming it's Ubuntu 10.04,

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update && sudo apt-get install sun-java6-jdk

should work.


You can install by apt-get:

apt-get install sun-java6-jre sun-java6-jdk
  • Ramesh ... I get this output. Reading package lists... Done Building dependency tree Reading state information... Done Package sun-java6-jdk is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package sun-java6-jdk has no installation candidate
    – Ankur
    Sep 14, 2010 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.