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 License By running this script to download Java you acknowledge that you have read 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 execute the 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 success All 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_64 ln -s /usr/lib/jni/* .
Then open Eclipse again to check it.

本文介绍了一种使用oab-java6脚本安装Sun Java 6的方法。通过创建本地APT仓库并利用该脚本进行安装,可以顺利安装Sun Java 6及其相关组件。文章还提供了解决Eclipse与OpenJDK搭配使用时可能出现的问题的方法。
2071

被折叠的 条评论
为什么被折叠?



