According to this blog on Java 9's new version string scheme, the version is supposed to be like MAJOR.MINOR.SECURITY
, i.e., there are supposed to be 3 numbers and 2 periods in between.
However, with Azul's Zulu 9, when I print the Java version, it has 4 numbers and 3 periods:
./jdk/bin/java -version
openjdk version "9.0.0.15"
OpenJDK Runtime Environment (Zulu build 9.0.0.15+181)
OpenJDK 64-Bit Server VM (Zulu build 9.0.0.15+181, mixed mode)
What do the 4 numbers represent ?
Not necessarily and you can validate the versions using the JDK itself as detailed below.
In addition to the JEP which holds true as linked by @Stephen in the other answer, there has been an API addition to the JDK as well for the
Runtime.Version
which can be used to validate a given version string. This can be done using a sample stub as :[I wonder using JShell could be interesting here, no IDEs!]
The code makes use of the
Version.parse
thatand can be further used(primarily) to get information like major, minor, pre-release and security number of the (runtime) version.
That blog posting is a bit out of date. The actually implemented scheme in Java 9 is documented in JEP 223: New Version-String Scheme
The meaning of the first three numbers is standardized. The meaning of the 4th and (any) subsequent numbers are left to the vendor to specify.
Note also the interesting relationship between the 2nd and 3rd numbers.
Here are the relevant parts of the JEP.