debian 8 和centos 配置java 环境变量的正确姿态

时间:2021-01-27 23:34:05

export JAVA_HOME=/usr/java/jre1.8.0_111
export JAVA_BIN=/usr/java/jre1.8.0_111/bin
export PATH=$PATH:$JAVA_BIN
export CLASSPATH=:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH

红色字体可以进入粗体目录视具体情况而定

export JAVA_HOME=/usr/java/jre1.8.0_111
export JAVA_BIN=/usr/java/jre1.8.0_111/bin
export PATH=$PATH:$JAVA_BIN
export CLASSPATH=:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386/jre
export JAVA_BIN=/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/bin
export PATH=$PATH:$JAVA_BIN
export CLASSPATH=:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH

别忘了source /etc/profile