导航
导航

[转载]Ubuntu 12.04 – install sun jdk 6-7

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 binfrom 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 1
    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_32/bin/java 1
    sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_32/bin/javaws 1
  • Choose default java:

    sudo update-alternatives --config javac
    sudo update-alternatives --config java
    sudo 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)

    sudo ln -s /usr/lib/jvm/jdk1.6.0_32/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins

    Installing Sun JDK 7 on Ubuntu 12.04:

  • Download the sun jdk 7 tar filefrom 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 1
    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_04/bin/java 1
    sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_04/bin/javaws 1
  • Choose default java:

    sudo update-alternatives --config javac
    sudo update-alternatives --config java
    sudo 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)

    sudo ln -s /usr/lib/jvm/jdk1.7.0_04/jre/lib/amd64/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 (Thanksshetty).

打赏
扫一扫,提供动力能源
  • 微信扫一扫
  • 支付宝扫一扫