公司上泛微OA,要求配置resin,需要首先配置Java环境,我在配置过程中进行了整理,希望可以帮到跟我一样情况的同学。
一:环境要求
1、OS : rehl 6.3
2、Java环境: JDK1.7.0_79
二、Java环境安装
1、下载JDK1.7,并放置到 Linux下的/mnt目录中,只是临时放置,位置自己定。
2、创建目录 /usr/java
[[email protected]_79]# mkdir /usr/java
3、将/mnt下的JDK1.7 移动到/usr/java下
[root@fanweiwebmnt]# mv jdk1.7.0_79/ /usr/java/
4、查看是否正确移动
[root@fanweiwebmnt]# cd /usr/java/
[root@fanweiwebjava]# ls
jdk1.7.0_79
[root@fanweiweb java]# cd jdk1.7.0_79/
[[email protected]_79]# ls
bin COPYRIGHT db include jre lib LICENSE man README.html release src.zip THIRDPARTYLICENSEREADME-JAVAFX.txt THIRDPARTYLICENSEREADME.txt
5、配置/etc/profile文件,在文件以下位置追加如下内容:(根据JDK实际放置路径位置,以下是我的路径)
exportJAVA_HOME=/usr/java/jdk1.7.0_79
exportJRE_HOME=/usr/java/jdk1.7.0_79/jre
exportPATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
exportCLASSPATH=/usr/java/jdk1.7.0_79/lib
以下打黄色的位置:
[root@fanweiweb~]# vi /etc/profile
# /etc/profile
# System wide environment and startupprograms, for login setup
# Functions and aliases go in /etc/bashrc
# It's NOT a good idea to change this fileunless you know what you
# are doing. It's much better to create acustom.sh shell script in
# /etc/profile.d/ to make custom changes toyour environment, as this
# will prevent the need for merging infuture updates.
pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
esac
}
if [ -x /usr/bin/id ]; then
if [ -z "$EUID" ]; then
# ksh workaround
EUID=`id -u`
UID=`id -ru`
fi
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi
# Path manipulation
if [ "$EUID" = "0" ];then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
pathmunge /sbin after
fi
HOSTNAME=`/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" ="ignorespace" ] ; then
export HISTCONTROL=ignoreboth
else
export HISTCONTROL=ignoredups
fi
######################### jdk1.7.0 #############################
export JAVA_HOME=/usr/java/jdk1.7.0_79
export JRE_HOME=/usr/java/jdk1.7.0_79/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export CLASSPATH=/usr/java/jdk1.7.0_79/lib
export PATH USER LOGNAME MAIL HOSTNAMEHISTSIZE HISTCONTROL
# By default, we want umask to get set.This sets it for login shell
# Current threshold for system reserveduid/gids is 200
# You could check uidgid reservationvalidity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id-gn`" = "`id -un`" ]; then
umask 002
else
umask 022
fi
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null 2>&1
fi
fi
done
unset i
unset pathmunge
6、不需要重启,直接读取/etc/profile文件
[[email protected]_79]# source /etc/profile
7、检查刚才配置的Java环境变量
[root@fanweiweb~]# echo $JAVA_HOME
/usr/java/jdk1.7.0_79
[root@fanweiweb~]# echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/java/jdk1.7.0_79/bin:/usr/java/jdk1.7.0_79/jre/bin:/root/bin
[root@fanweiweb~]# echo $CLASSPATH
/usr/java/jdk1.7.0_79/lib
[root@fanweiweb~]# echo $JRE_HOME
/usr/java/jdk1.7.0_79/jre
8、检查Java是否安装成功,检查版本即可
[root@fanweiweb~]# java -version
javaversion "1.7.0_79"
Java(TM)SE Runtime Environment (build 1.7.0_79-b15)
JavaHotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
[root@fanweiweb~]#
到此,Java配置成功。