Reputation: 681
When I check my Java version like this:
java -version
I see openjdk version 1.8.0 runtime environment build ...
, but I thought I had Java 8 installed.
Why does the version number show up as 1.8?
Upvotes: 58
Views: 104001
Reputation: 26729
Before Java 9, Java version X
was internally specified as 1.X
according to these specs.
Then came JEP 223 which proposed to change the version to just X
starting with Java 9.
It should be noted that different tools may even use other conventions. For instance in Gradle there is JavaVersion.VERSION_1_9
, JavaVersion.VERSION_1_10
and they only switch to the new convention in JavaVersion.VERSION_11
(see their code comment).
Upvotes: 21
Reputation: 6813
From Java Platform, Standard Edition 8 Names and Versions:
In JDK 8 and JRE 8, the version strings are 1.8 and 1.8.0
Why? Because the developers of Java chose to name the versions like this. I can only assume the real reasons, but I think it is, because naming it Java 8 implies that it is new and much better than Java 7 but keeping the version bump from 1.7 to 1.8 indicates that it is still version 1.x and therefore still backwards compatible. In the end it is marketing.
See also Why is Java version 1.X referred to as Java X?.
Upvotes: 49