Ubuntu 12.04 install java sdk 6

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

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.

 Posted by ian at 18:36  Tagged with: java
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值