Ubuntu 10.04 下安装 JDK5

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

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。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/26500.html