Install Sun JDK 6-7

Source: Internet
Author: User

Ubuntu GNU/Linux 12.04 lts (precise pangolin) released. I wanted to manually install the Sun JDK 6 and 7 on Ubuntu.

Installing Sun JDK 6 on Ubuntu 12.04:

  • Download the Sun JDK 6 Bin
    From here.
  • Make the BIN file executeable:
chmod +x jdk-6u32-linux-x64.bin
  • Extract the BIN file:
./jdk-6u32-linux-x64.bin
  • Move extracted folder to this location:
sudo mv jdk1.6.0_32 /usr/lib/jvm/
  • Install new Java source in system:
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_32/bin/javac 1sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_32/bin/java 1sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_32/bin/javaws 1
  • Choose Default Java:
sudo update-alternatives --config javacsudo update-alternatives --config javasudo update-alternatives --config javaws
  • Java version test:
java -version
  • Verify the symlinks all point to the new Java location:
ls -la /etc/alternatives/java*
  • Enable Java Plugin for Mozilla Firefox (even for chrome)
#for 64-Bit jdksudo ln -s /usr/lib/jvm/jdk1.6.0_32/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins#for 32-Bit jdksudo ln -s /usr/lib/jvm/jdk1.6.0_32/jre/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins

Installing Sun JDK 7 on Ubuntu 12.04:

  • Download the Sun JDK 7 tar file
    From here
  • Extract the tar file:
tar -xvzf jdk-7u4-linux-x64.tar.gz
  • Move extracted folder to this location:
sudo mv jdk1.7.0_04 /usr/lib/jvm/
  • Install new Java source in system:
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_04/bin/javac 1sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_04/bin/java 1sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_04/bin/javaws 1
  • Choose Default Java:
sudo update-alternatives --config javacsudo update-alternatives --config javasudo update-alternatives --config javaws
  • Java version test:
java -version
  • Verify the symlinks all point to the new Java location:
ls -la /etc/alternatives/java*
  • Enable Java Plugin for Mozilla Firefox (even for chrome)
#for 64-Bit jdksudo ln -s /usr/lib/jvm/jdk1.7.0_04/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins#for 32-Bit jdksudo ln -s /usr/lib/jvm/jdk1.7.0_04/jre/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins

Update:I have added Java Web Start configuration (Thanks Jack ).

Update:I have added Java Plugin configuration for Mozilla Firefox even for chrome (thanks
Shetty).

Update:Java_home configuration: some tools require java_home variable. You can set java_home in Ubuntu so simple: edit the file
. BashrcUnder your home directory and add the following lines: (if. bashrc is hidden click in Nautilus menu View> show hidden files)

export JAVA_HOME=/path/your/jdkexport PATH=$JAVA_HOME/bin:$PATH

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.