Every Java developer at some point comes across the following Exception and wonders what the strange numbers mean.
Exception in thread "main" java.lang.UnsupportedClassVersionError: java\SampleClass : Unsupported major.minor version 51.0
This happens when the class file has been compiled for a newer Java version than the version of the runtime, that is trying to load the class. But why the heck is it such a strange version number like 51.0 and what version of Java is this?
In the third part of the series about the Java Class File Format I take a look at the minor and major version information.
Continue reading “Java Class File Major & Minor Version”
As we saw in the last post each Java class file starts with the so-called “magic” section. This has historic reasons and goes back to the very early days of the Java language. You may take a look here or here for more details about James Goslings decision.
Continue reading “0xCAFEBABE – The Java Class File Magic Number”
The Java Class File Format is the format in which Java classes are stored when Java source files are compiled by the Java compiler. It includes all the information from the source files as well as some optimizations, but in a format the JVM can handle.
A complete description can be found in chapter 4 of the Java Virtual Machine Specification.
Continue reading “The Java Class File Format – an Overview”
Did you ever read that ("string 1" == "string 1") == true but ("string 1" == new String("string 1")) == false? Ever came across the terms “Constant Pool“, “StackMapTable” or the “java.lang.UnsupportedClassVersionError: Unsupported major.minor version” exception?
Continue reading “Learning the Java Class File Format”
So I start this blogging thing. Again. But Why?
To gain some knowledge, learn and examine some stuff and write about it. So you, my dear reader, may benefit from my wisdom.
There are so many interesting things in technology out there. So many things to learn, to try, to read about. And to write about, because writing is one of the best forms of learning. As a side-effect, I hope my English writing will improve a little bit too.