1. 打開『synaptic』,點選[設定] => [套件庫],點選「其他軟體」頁籤
將『Canonical 夥伴』及『Canonical 夥伴 (源碼)』勾選起來。
(※ 『Canonical 夥伴 (源碼)』可以不用勾,我是順便)
[關閉]之後記得『重新載入』一下
2.在『快速過濾』填入「sun-java-6」,然後選取『sun-java6-jre』、『sun-java6-jdk』、『sun-java6-plugin』
(※ 其他需不需要裝看個人嗜好)
3.可是系統中還有一個『Openjdk』怎麼辦?
使用切換程式切換過來,
切換前:
$ java -version java version "1.6.0_22" OpenJDK Runtime Environment (IcedTea6 1.10.2) (6b22-1.10.2-0ubuntu1~11.04.1) OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode) |
切換後:
$ sudo update-java-alternatives -s java-6-sun [sudo] password for max: max@minako:~$ java -version java version "1.6.0_26" Java(TM) SE Runtime Environment (build 1.6.0_26-b03) Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode) |
4.設定環境變數
修改『/etc/environment』
修改前:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" |
修改後:
JAVA_HOME="/usr/lib/jvm/java-6-sun" PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-sun/bin" CLASSPATH=".:/usr/lib/jvm/java-6-sun/lib:/usr/lib/jvm/java-6-sun/lib/dt.jar:/usr/lib/jvm/java-6-sun/lib/tools.jar" |
重登入以後測試一下環境變數,
$ echo $CLASSPATH .:/usr/lib/jvm/java-6-sun/lib:/usr/lib/jvm/java-6-sun/lib/dt.jar:/usr/lib/jvm/java-6-sun/lib/tools.jar max@minako:~$ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-sun/bin max@minako:~$ echo $JAVA_HOME /usr/lib/jvm/java-6-sun |
完工~~~~
沒有留言:
張貼留言