1、抓取 JDK 7
http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz
或是可於終端機下輸入
wget -c http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz
2、解壓縮:
將jdk-7-linux-i586.tar.gz 複製到/home/[userid] 裡面
將解壓縮後的JDK放置於/usr/lib/jvm,終端機下輸入
cd /usr/lib
sudo mkdir jvm
cd /home/[userid]
sudo tar zxvf ./jdk-7-linux-i586.tar.gz -C /usr/lib/jvm
更名為sun-java-7
cd /usr/lib/jvm
sudo mv jdk1.7.0/ sun-java-7
3、修改環境變數:
將相關路徑參數添加入~/.bashrc檔案中
vi ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/sun-java-7
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
4、更新設定檔:
source ~/.bashrc
5、確認是否有更新:
java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Server VM (build 21.0-b17, mixed mode)
Related Posts :
- Back to Home »
- [小PのIT筆記]android開發環境建置 »
- 【Android】於Ubuntu 上安裝 JDK 7