debian下安装JAVA

in Debian with 0 comment

先下载,地址

java7 http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html

java8 http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html

在user建立目录并解压

mkdir /usr/java && tar -zxvf jdk-7u79-linux-x64.tar.gz && mv jdk1.7.0_79 /usr/java/java7

编辑/root目录下的.bashrc,在末尾添加

export JAVA_HOME=/usr/java/java7
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib

设置JDK java优先级

update-alternatives --install /usr/bin/java java /usr/java/java7/bin/java 1100
update-alternatives --install /usr/bin/javac javac /usr/java/java7/bin/javac 1100

这时输入java -version就会有如下输出

java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

成功!

 

粤ICP备15078260号-3