Jdk安装:
[root@bhome]#ls
jdk-1_5_0_12-linux-i586-rpm.binlost foundoracle
1、将jdk进行解压
[root@bhome]#./jdk-1_5_0_12-linux-i586-rpm.bin
2、将解压文件copy到/usr/java下
[root@bhome]#cpjdk-1_5_0_12-linux-i586.rpm/usr/java
[root@bhome]#cd/usr/java
3、进行安装
[root@bjava]#rpm-ivhjdk-1_5_0_12-linux-i586.rpm
Preparing...(###########################################[100%]
packagejdk-1.5.0_12-fcsisalreadyinstalled
4、将环境变量加入到profile中,如果写入到(/etc/profile)对所有用户都生效,如果只对某个用户生效写入到(/home/username/profile)中
exportJAVA_HOME=/usr/java/jdk1.5
exportPATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
exportCLASSPATH=.:/usr/java/jdk1.5/lib:/usr/java/jdk1.5/jre/lib:$CLASSPATH
5、验证安装结果
[root@bjava]#java-version
-bash:java:commandnotfound
错误原因是环境变量未生效。
[root@bjava]#source/etc/profile
[root@bjava]#java-version
javaversion"1.5.0_12"
Java(TM)2RuntimeEnvironment,StandardEdition(build1.5.0_12-b04)
JavaHotSpot(TM)ClientVM(build1.5.0_12-b04,mixedmode,sharing)
至此安装成功。
jdk下载地址:
Tomcat安装:
1、将文件copy到/usr/local下解压安装文件
[root@blocal]#tar-zxvfapache-tomcat-5.5.23.tar.gz
[root@blocal]#ls
apache-tomcat-5.5.23bingameslibmanshare
apache-tomcat-5.5.23.tar.gzetcincludelibexecsbinsrc
[root@blocal]#cd~
2、加入环境变量
[root@broot]#vi.bashrc
exportJAVA_HOME=/usr/java/jdk1.5.0_12
exportCLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
exportPATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin
exportCATALINA_BASE=/usr/local/apache-tomcat-5.5.23
exportCATALINA_HOME=/usr/local/apache-tomcat-5.5.23
3、使环境变量生效
[root@broot]#source.bashrc
4、验证安装结果
[root@broot]#echo$JAVA_HOME
/usr/java/jdk1.5.0_12
[root@broot]#echo$CATALINA_HOME
/usr/local/apache-tomcat-5.5.23
[root@broot]#
(责任编辑:凌云通)
下载本文示例代码
阅读(247) | 评论(0) | 转发(0) |