Ubuntu 12.04 install java sdk 6

来源:互联网 发布:sql查密码 编辑:程序博客网 时间:2024/05/20 00:51

From https://help.ubuntu.com/community/Java, use oab-java6 method.

1. git clone https://github.com/flexiondotorg/oab-java6.git

current version is : V0.2.4.

2. sudo ./oab-java.sh

———logs———--

oab-java.sh v0.2.4 - Create a local 'apt' repository for Sun Java 6 and/or Oracle Java 7 packages.Copyright (c) Martin Wimpress, http://flexion.org. MIT LicenseBy running this script to download Java you acknowledge that you haveread and accepted the terms of the Oracle end user license agreement.* http://www.oracle.com/technetwork/java/javase/terms/license/If you want to see what this is script is doing while it is running then executethe following from another shell:  tail -f /home/ian/tools/oab-java6/oab-java.sh.log [x] Installing Java build requirements success [x] Making build directories success [x] Removing clones of https://github.com/rraptorr/sun-java6 success [x] Cloning https://github.com/rraptorr/sun-java6 success [x] Checking out v6.33-1 success [x] Getting Java SE download page success [x] Getting current release download page success [x] Downloading jdk-6u33-linux-i586.bin : 68.42 MB success [x] Symlinking jdk-6u33-linux-i586.bin success [x] Downloading jdk-6u33-linux-x64.bin : 68.69 MB success [x] Symlinking jdk-6u33-linux-x64.bin success [x] Getting Java Cryptography Extension download page success [x] Downloading jce_policy-6.zip : 8.89 KB success [x] Symlinking jce_policy-6.zip success [x] Updating the changelog success [x] Building the packages success [x] Moving the packages success [x] Creating Packages.gz file success [x] Creating Release file success [x] Signing the 'Release' file success [x] Exporting public key success [x] Adding public key success [x] Update package list successAll done!

3. sudo apt-get install sun-java6-jdk sun-java6-fonts sun-java6-source Note: Use Step 2 (oab-java.sh) ,” a local apt repository is created that hosts locally built Java packages applicable to your system. It is up to you to install or upgrade the Java packages you require using apt-get, aptitude or synaptic, etc.” from: oab-java6

4. sudo update-alternatives --config java

There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
————————————————————
* 0 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/java to provide /usr/bin/java (java) in manual mode.

5. Check version now:

$java -version
java version “1.6.0_33″
Java(TM) SE Runtime Environment (build 1.6.0_33-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03, mixed mode)

NOTE:

If you have worked with Eclipse + OpenJDK, it may has some errors when run Eclipse again, like ‘/home/ian/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/1111.log.’ When read this log, it sasy:

java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-gtk-3740 in java.library.path
no swt-gtk in java.library.path
Can’t load library: /home/ian/.swt/lib/linux/x86_64/libswt-gtk-3740.so
Can’t load library: /home/ian/.swt/lib/linux/x86_64/libswt-gtk.so

You can fix this by following these steps: [ref: Exception in thread “main” java.lang.UnsatisfiedLinkError: Could not load SWT library]

cd ~/.swt/lib/linux/x86_64ln -s /usr/lib/jni/* .

Then open Eclipse again to check it.

 Posted by ian at 18:36 Tagged with: java
原创粉丝点击