My studying notes for Java,Ruby,Ajax and other any interesting things.

星期日, 九月 29, 2013

在centos中安装java

近期准 备将一些服务迁移到java环境中来,简单记录一些操作过程。

1.检查是否安装了openjdk,如果是的话,卸载重新安装oracle官方的jdk
java -version --查看java版本号
rpm -qa|grep java  查看rpm中安装的jdk版本信息
java-1.6.0-openjdk-1.6.0.0-1.40.1.11.11.el5_9
tzdata-java-2013c-1.el5
2.卸载默认安装的jdk信息,使用yum即可:
yum -y remove java-1.6.0-openjdk-1.6.0.0-1.40.1.11.11.el5_9
yum -y remove tzdata-java-2013c-1.el5
3.到oracle官方网站中下载jdk信息,通常使用tar.gz包进行安装:
可以通过uname -a查看自己的linux版本,可以下载32或者64位的jdk安装包
4.安装过程:
mkdir /usr/java
cp *.gz /usr/java
cd /usr/java
tar -xvzf jdk-7u13-linux-x64.gz
mv jdk1.7.0_13 jdk
          如果下载的是rpm包的话可以使用:rpm -ivh jdk-7u13-linux-x64.rpm 进行安装
5.修改profile:
vi /etc/profile 
加入:
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
export JAVA_HOME=/usr/java/jdk
export PATH=$JAVA_HOME:$PATH
export CLASSPATH=.;$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 

然后执行source /etc/profile,令其当前生效,输入java -version检查是否安装完毕


本邮件及其附件含有"赶集网"的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!

This e-mail and its attachments contain confidential information from GanJi, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!

没有评论: