歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu 10.04 下安裝 JDK5

Ubuntu 10.04 下安裝 JDK5

日期:2017/2/28 16:32:16   编辑:Linux教程

Now my os is Ubuntu10.4.And there are lots of problem with me and Ubuntu.

How can i set chinese input ?

I can see PinYin Input,but it does not work.....

It is not the main proble about today .Writing in english will give me some chance.

1:Down Load JDK 5,The lastest is JDK 6, you can get from system/Systmemanger/PackageManger.But there is no JDK5 Resource.

So you need to download it from the sun. I can confirm that there is it in www.sun.com.

what i got is : jdk-1_5_0_22-linux-i586.bin

Do you have got what you need ?

2:Put jdk-1_5_0_22-linux-i586.bin file to my /home/administrator/java directory.

3:in Command Line Interface ,you need get in the file directory /home/administrator/java

sudo chmod u+x jdk-1_5_0_22-linux-i586.bin

./jdk-1_5_0_22-linux-i586.bin

then you see some readme about sun .......

more and more .

將會出現字幕,持續按回車鍵,直至屏幕顯示要求輸入yes/no,此時輸入y回車,將會把jdk解壓到文件夾,得到jdk1.6.0_12目錄。
此時,jdk已安裝完畢,下面進行配置
執行

代碼:
sudo vi /etc/profile

在profile中修改,出現如下部分

引用:
# Set JAVA (這裡是注釋 不是SHELL命令)
JAVA_HOME=/home/administrator/下載/jdk1.5.0_22
JRE_HOME=/home/administrator/下載/jdk1.5.0_22/jre
PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
export PATH


執行

代碼:
sudo source /etc/profile

此時,環境變量設置成功(設置環境變量的方法很多,不一一列舉)
由於ubuntu中可能會有默認的jdk,如openjdk,所以,為了使默認使用的是我們安裝的jdk,還要進行如下工作。
執行

代碼:
update-alternatives --install /usr/bin/java java /usr/lib/jvm/java/jdk1.6.0_12/bin/java 300
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java/jdk1.6.0_12/bin/javac 300


通過這一步將我們安裝的jdk加入java選單。
然後執行

代碼:
update-alternatives --config java


通過這一步選擇系統默認的jdk
這樣,再在shell中輸入

代碼:
java -version


時,就會顯示系統使用的java是sun的java。

Copyright © Linux教程網 All Rights Reserved