Why do Java class file versions start from 45?

Ivan Babanin :

According to the JVM specification:

Oracle's Java Virtual Machine implementation in JDK release 1.0.2 supports class file format versions 45.0 through 45.3 inclusive. JDK releases 1.1.* support class file format versions in the range 45.0 through 45.65535 inclusive. For k ≥ 2, JDK release 1.k supports class file format versions in the range 45.0 through 44+k.0 inclusive.

https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html

I'm wondering, why did they start versioning from 45 and not, say, from 1 or 0?

Stephen C :

Why do Java class file versions start from 45?

There were versions of Java before the first publicly released version (Java 1.0.2).

Java originally started life as the Oak programming language in 1991. It was renamed as Java in 1994 and the first public release was in 1996.

It is safe to assume that classfile versions less than 45 were used for earlier (pre-release) versions of Java and probably Oak. In the early days, it is likely that the developers made numerous changes to the bytecode instruction set and other aspects of the classfile format. That would have required "bumping" the classfile version number on a regular basis.

This above is conjecture. There is very little publicly available information on Oak and pre-1.0 Java. However, the text of the Oak specification from 1993 indicates that they were already compiling Oak source code to bytecodes that were stored in ".class" files, one per class.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=305066&siteId=1