15
我需要一個bash行來檢查當前安裝的java版本是Oracle還是OpenJDK。Bash命令檢查Linux或OpenJDK java版本是否安裝在Linux上
甲單行通過解析java -version
命令的輸出:
java -version
的java甲骨文輸出:
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
的java OpenJDK的輸出:
java version "1.7.0_91"
OpenJDK Runtime Environment (amzn-2.6.2.2.63.amzn1-x86_64 u91-b00)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)