ubuntu中java环境变量的配置

如果你用的是apt-get install sun-java6-jdk来安装的话,环境变量可以不用配置,它已经自动配置好了,如果有必要配置环境变量的时候,有以下两种方法,一种是通过profile文件,另一种是通过environment来配置。。具体方法如下:
profile 或environment配置其中一个就可以
profile:
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "$PS1" ]; then
if [ "$BASH" ]; then
PS1='\u@\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export PATH=$PATH:/usr/lib/jvm/java-6-sun/bin
export CLASSPATH=./:/usr/lib/jvm/java-6-sun/lib/tools.jar:/usr/lib/jvm/java-6-sun/lib/dt.jar:/usr/lib/jvm/java-6-sun/lib/rt.jar:/usr/lib/jvm/java-6-sun/lib
umask 022


environment:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh:en_US:en"
CLASSPATH=./:/usr/lib/jvm/java-6-sun/lib
JAVA_HOME=/usr/lib/jvm/java-6-sun

你可能感兴趣的:(java,jvm,ubuntu,bash,sun)