Install the Oracle JDK 6

来源:互联网 发布:win7小马激活软件 编辑:程序博客网 时间:2024/05/16 14:02

Oracle themselves have the official guide to install their JDK - below is based upon those instructions.

  • Download the 32bit or 64bit Linux "compressed binary file" - it has a ".bin" file extension
  • Give it permissions to execute and extract it

    chmod a+x [version]-linux-i586.bin

    ./[version]-linux-i586.bin

During installation it will ask you to register - press ENTER. Firefox will open with the registration page. Registration is optional.

JDK 6 package is extracted into ./jdk1.6.0_x directory, for example./jdk1.6.0_30.

Lets rename it:

mv jdk1.6.0_30 java-6-oracle
  • Now move the JDK 6 directory to /usr/lib

sudo mkdir /usr/lib/jvm

sudo mv java-6-oracle /usr/lib/jvm

switch to Oracle JDK 6

webupd8.googlecode.com hosts a nice-easy script to help with this.

wget http://webupd8.googlecode.com/files/update-java-0.5bchmod +x update-java-0.5bsudo ./update-java-0.5b

don't worry - 0.5b refers to the script version - not the version of java!

An alternative to this is to use the webupd8 ppa and the update-java package.

enter image description here

Finally test the switch has been successful:

java -versionjavac -version

原创粉丝点击