1. sudo mkdir /usr/lib/jvm
2.官网下载jdk jdk下载,以jdk1.8.0_40为例
解压后,移动到/usr/lib/jvm下
3. sudo vim bash.bashrc,添加:
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_40
export JAVA_BIN=$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar;$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_BIN
4. java -version
5. $ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_40/bin/java 300
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_40/bin/javac 300
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
一个字形容:帅