首先,去官網下載最新的JDK,網址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htmlhtml
將jdk-8u91-linux-x64.tar.gz解壓java
usr@usr-VirtualBox:~$ tar xzf ~/下載/jdk-8u91-linux-x64.tar.gzlinux
將解壓的文件夾移動到/opt/目錄下bash
usr@usr-VirtualBox:~$ sudo mv ./jdk1.8.0_91 /opt/oracle
配置java環境,在家目錄下的.bashrc中,添加export PATH=$PATH:/opt/jdk1.8.0_91/binide
usr@usr-VirtualBox:~$ vi ~/.bashrchtm
添加
ci
export PATH=$PATH:/opt/jdk1.8/binget
5. 成功it
usr@usr-VirtualBox:~$ javac -version javac 1.8.0_91