HowTo: install Sun/Oracle Java SDK on Ubuntu

if you Google “ubuntu java sdk install” you’ll see i’m not the only one that wasn’t sure the “right” way to get the official Sun/Oracle Java SDK onto Ubuntu. Ubuntu has it’s own “standard” JDK and that just confuses things if you’re after the Sun version.

you can of course download a file directly from Oracle. it’s a .bin file that you need to set executable, then figure out the best place to let it extract, and of course setup your paths. being brand new to Linux, i was thinking “too many places to screw this up, must be better way.” turns out there is, but even for that i had to try several variations of people’s instructions. here’s what worked for me:

 

  1. (this is for Ubuntu 11.04 Natty Narwhal)
  2. (in the toolbar main menu) choose Applications > Ubuntu Software Center
  3. (in the Software Center) choose Edit > Software Sources
  4. select the “Other Software” tab
  5. check both “Canonical Partners” checkboxes
  6. click “Close”
  7. (in the Software Center) in the upper right hand corner search box, search for “Sun JDK”
  8. you should see an item “Sun Java(TM) Development Kit (JDK) 6” in the list. you may have to click “Show XX technical terms” at the bottom of the Software Center dialog to see this!
  9. select that item and an “Install” button will appear below it. click it and off it goes!

after it finished, i also installed the demo/sample files (sun-java6-demo package).

you should now have an Applications > System Tools > Sun Java 6 VisualVM menu item. you can also confirm install by using terminal and typing java -version (you should get back runtime version info).

 

this is of course the standard “ez” way to get software on Ubuntu. from what i can tell the original confusion came from Sun not updating the repository on-time. so for a while this wasn’t possible and people were doing it several different ways…

say something about this post

  • (will not be published)