# 解壓在官方下載的Linux二進(jìn)制包
sudo mkdir /usr/lib/jvm sudo tar zxvf ./jdk/jdk-7-linux.tar.gz -C /usr/lib/jvm cd /usr/lib/jvm # 設(shè)置環(huán)境變量(Bash) ## 如果你是使用的是zsh等其他sh請參考相應(yīng)文檔配置 vim ~/.bashrc export JAVA_HOME=/usr/lib/jvm/jdk1.7.0 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH # 更新 ~/.bashrc source ~/.bashrc # 設(shè)置默認(rèn)JDK版本 sudo update-alternatives --install /usr/bin/java java ${JAVA_HOME}/bin/java 300 sudo update-alternatives --install /usr/bin/javac javac ${JAVA_HOME}/bin/javac 300 sudo update-alternatives --install /usr/bin/jar jar ${JAVA_HOME}/bin/jar 300 sudo update-alternatives --install /usr/bin/javah javah ${JAVA_HOME}/bin/javah 300 sudo update-alternatives --install /usr/bin/javap javap ${JAVA_HOME}/bin/javap 300 sudo update-alternatives --config java |
|