1. 程式人生 > >ubuntu下安裝JRE環境

ubuntu下安裝JRE環境

下載JRE安裝檔案

http://download.oracle.com/otn-pub/java/jdk/6u34-b04/jre-6u34-linux-i586.bin?AuthParam=1353895768_6a8a0476485ff0373ab344fed6e51f90

設定為可執行檔案

chmod a+x jre-6u34-linux-i586.bin

執行

./jre-6u34-linux-i586.bin

sudo mkdir -p /usr/lib/jvm
sudo mv jre1.6.0_34 /usr/lib/jvm/

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.6.0_34/bin/java" 1
sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jre1.6.0_34/lib/i386/libnpjp2.so" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jre1.6.0_34/bin/javaws" 1
配置環境
sudo vi /etc/profile
export J2RE_HOME=/usr/lib/jre
export PATH=$J2RE_HOME/bin:$PATH

重啟終端輸入以下命令檢視是否安裝成功
java -version

java version "1.6.0_34"
Java(TM) SE Runtime Environment (build 1.6.0_34-b04)
Java HotSpot(TM) Client VM (build 20.9-b04, mixed mode, sharing)