因要装 SonarQube,必须要升级到 8 才行(SONAR_Requirements)。当前 opensdk 版本为 7:
- # java -version
- java version "1.7.0_101"
- OpenJDK Runtime Environment (IcedTea 2.6.6) (7u101-2.6.6-0ubuntu0.14.04.1)
- OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
升级步骤后如下:
1,安装 opensdk 8:
- # add-apt-repository ppa:openjdk-r/ppa
- # apt-get update
- # apt-get install openjdk-8-jdk
2,为了避免版本差异,7 暂时保留,故先手工切换默认 opensdk:
- # update-java-alternatives -l
- java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
- java-1.8.0-openjdk-amd64 1069 /usr/lib/jvm/java-1.8.0-openjdk-amd64
- # update-alternatives --config java
- There are 2 choices for the alternative java (providing /usr/bin/java).
- Selection Path Priority Status
- ------------------------------------------------------------
- 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
- 1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
- * 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1069 manual mode
- Press enter to keep the current choice[*], or type selection number: 2
- # java -version
- openjdk version "1.8.0_91"
- OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~14.04-b14)
- OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
大功告成:)