安装jdk
- yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel (这样安装的jdk目录在/usr/lib/jvm)
- 为了规范进入/usr/lib/jvm mv java /usr/local/jdk1.8
- 配置环境变量vi /etc/profile 在文件最后加入如下行
#set java environment
JAVA_HOME=/usr/local/jdk1.8
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar
export JAVA_HOME CLASSPATH PATH
- 执行如下命令使设置生效
source /etc/profile
jdk和tomcat安装配置
http://blog.51cto.com/13525470/2073657
在tomcat的bin目录下vim startup.sh和shutdown.sh分别都加入如下配置
# Better OS/400 detection: see Bugzilla 31132
export JAVA_HOME=/usr/local/jdk1.8
export TOMCAT_HOME=/usr/local/tomcat7
export CATALINA_HOME=/usr/local/tomcat7
export CLASS_PATH=$JAVA_HOME/bin/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tool.jar
export PATH=$PATH:$JAVA_HOME/bin:/usr/local/tomcat7/bin