(This article is a multipost with Go to the horizon)
Java has changed to a time-based release since version 10. Along with that, the version notation has changed again, so I have summarized it. [^ 1]
[^ 1]: But almost the same as Java 9
See JEP 322: Time-Based Release Versioning for details.
There are four notations: $ FEATURE. $ INTERIM. $ UPDATE. $ PATCH
.
Specifically, it is written as 10.0.1.2
.
(The notation "Update up to Java 8" has disappeared)
meaning | timing | Next time | Contents | |
---|---|---|---|---|
$FEATURE |
Feature release | Every six months | March 2018 | 内容にかかわらずEvery six monthsにリリース Feature additions, incompatible changes, feature removal[^del]including |
$INTERIM |
Intermediate release | no plan | - | Compatible bug fixes and enhancements[^enhancements] (Does not include changes to standard API) |
$UPDATE |
Update release | 1 month after feature release, and every 3 months thereafter | April 2018 July 2018 |
Security fix Bug fixes for the latest features |
$PATCH |
Patch release | Only when needed | - | Minimal fix to solve a serious problem |
[^ del]: In this case, it will be announced in at least the previous feature release. [^ enhancements]: It seems that it is supposed to be a case like JDK1.4.1, JDK1.4.2.
--If all digits after a certain digit are 0, omit it.
--Example: 11.0.0.0 → 11
--Example: 11.0.2.0 → 11.0.2
--If $ FEATURE
, $ INTERIM
is incremented, the numbers after that will be reset.
--Example: 11.0.2 → 11.0.2.1 → 11.1 → 11.1.1
--The following is given after the version number
--Pre-release identifier (optional)
--Example: 11.0.2-ea
--Build number
--Example: 11.0.2 + 13
--Optional information such as LTS (optional)
--Example: 11.0.2 + 13-LTS
These can be obtained with each method of the Runtime.Version class.
jshell> Runtime.version().feature()
$1 ==> 10
jshell> Runtime.version().interim()
$2 ==> 0
jshell> Runtime.version().update()
$3 ==> 0
jshell> Runtime.version().patch()
$4 ==> 0
jshell> Runtime.version().pre()
$6 ==> Optional.empty
jshell> Runtime.version().build()
$5 ==> Optional[46]
jshell> Runtime.version().toString()
$7 ==> "10+46"
Is it newer than one version? Is it old? If you want to check, it is better to compare with the compareTo
method than to compare one by one above.
jshell> Runtime.version().toString()
$1 ==> "10+46"
jshell> Runtime.version().compareTo(Runtime.Version.parse("10.0.1")) > 0
$2 ==> false
jshell> Runtime.version().compareTo(Runtime.Version.parse("9.0.1")) > 0
$3 ==> true
However, Runtime.Version
is a class added in Java 9.
Please note that if you need to support Java 8 or earlier, you can only get it from the system property java.version
.
jshell> System.getProperty("java.version")
$4 ==> "10"
"Release date [^ 3]" and "Vendor version" have been added to the system properties.
For the Oracle JDK, the vendor version seems to remain the originally planned release year.release month
.
[^ 3]: To be exact, the GA date. So, the Eary Access version will have a future date.
jshell> System.getProperty("java.version.date")
$1 ==> "2018-03-20"
jshell> System.getProperty("java.vendor.version")
$2 ==> "18.3"
Recommended Posts