关键字: LINUX JDK
1. 以root身份登录系统
2.转到文件夹/usr下,cd /usr。新建文件夹java mkdir java,安装文件用samba拷贝到/usr/java下:
3.通过chmod +x jdk-6u7-linux-i586.bin命令使其获得可执行权限
4.通过 ./jdk-6u7-linux-i586.bin来进行安装
5.安装完毕,JDK安装在/usr/java/目录下
6.设置环境变量(写入/etc/profile中)
vi /etc/profile
文件修改如下,红字部分为需要修改部分
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
# Path manipulation
#if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
# Functions and aliases go in /etc/bashrc
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
# Path manipulation
#if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
#fi
pathmunge /usr/X11R6/bin after
unset pathmunge
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
#fi
pathmunge /usr/X11R6/bin after
unset pathmunge
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
INPUTRC=/etc/inputrc
fi
JAVA_HOME=/usr/java/jdk1.6.0_07
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME CLASSPATH
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
if [ -r "$i" ]; then
. $i
fi
done
unset i
export G_BROKEN_FILENAMES=true
注销,并重新登录
okay了键入 java -version 如果出现相关linux安装jdk18并配置环境变量JDK版本信息,证明成功.
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论