Install Sun (Oracle) Java on Ubuntu without using PPAs

Install JDK on Ubuntu manually without depending on PPAs –

  1. Select the required package from here – http://www.oracle.com/technetwork/java/javase/downloads/index.html. Download the jdk-[version].bin file from the downloads page.
  2. Make the downloaded file runnable; Eg – sudo chmod +x jdk-6u32-linux-x64.bin
  3. Run this file; Eg- sudo ./jdk-6u32-linux-x64.bin
  4. Move the newly created folder to /usr/lib/jvm/. Eg – sudo mv jdk1.6.0_32 /usr/lib/jvm/ (Optionally change the user of this folder to yourselves)
  5. Add the newly added jdk to known java command option –
    sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_32/bin/java" 1
    sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_32/bin/javac" 1
    sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.6.0_32/bin/javaws" 1
  6. Choose the new java, javac and javaws by running commands-
    sudo update-alternatives --config java
    sudo update-alternatives --config javac
    sudo update-alternatives --config javaws

Run java -version to verify installation. Cheers!

Sreekumar Kj
Sreekumar (KJ) has been a hobby programmer from school days. Codemarvels is his personal blog from the year 2010, where he writes about technology, philosophy, society and a bit about physics. He now runs a conversational AI company - DheeYantra - focusing his efforts to help businesses improve operational efficiency using digital employees powered by AI.