viewhack

Java class and JAR viewer: which Java version does it need?

Got UnsupportedClassVersionError, or a jar you did not build? Drop the .jar or .class here. You get the Java version every class needs, the manifest with its Main-Class, the packages and classes, the Maven libraries bundled inside and who signed it. Each class shows its methods as Java signatures, its strings and its bytecode.

The file is read by this tab only. It is not uploaded and nothing in it is run.

What it shows

What it cannot do

Class file versions and Java releases

The number after “class file version” in a Java error is the major version of the class. Since Java 5 the rule is simple: Java N writes major version 44 + N. A JVM runs every class up to its own number and refuses anything newer.

Major versionJava releaseMajor versionJava release
45JDK 1.0.2 and 1.1 (minor 3)58Java 14
46Java 1.259Java 15
47Java 1.360Java 16
48Java 1.461Java 17 (LTS)
49Java 562Java 18
50Java 663Java 19
51Java 764Java 20
52Java 8 (LTS)65Java 21 (LTS)
53Java 966Java 22
54Java 1067Java 23
55Java 11 (LTS)68Java 24
56Java 1269Java 25 (LTS)
57Java 1370Java 26

Useful to know

Reading the error
UnsupportedClassVersionError: com/example/App has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0 means App needs Java 17 (61) and the java that ran it is Java 8 (52). Either run it with Java 17 or newer (check with java -version; an IDE or build tool may use a different Java than your terminal), or rebuild the code with javac --release 8 (Maven: <maven.compiler.release>8</maven.compiler.release>).
Build-Jdk-Spec is not the version you need
The manifest's Build-Jdk-Spec or Created-By says which Java ran the build, not which Java the classes target. Apache Commons CLI 1.9.0 is an example: its manifest says Build-Jdk-Spec: 17, but its classes are version 52 and run on Java 8. Only the class files tell you the version they need.
Multi-release jars
Since Java 9, a jar whose manifest says Multi-Release: true can carry extra copies of classes under META-INF/versions/N/, which Java N and newer load instead of the base ones. Older Javas ignore that folder, so the base classes set the minimum. Many libraries put just a module-info.class in META-INF/versions/9/ to become a named module while still running on Java 8.
Preview features
A class compiled with --enable-preview has minor version 65535. It runs only on exactly the Java release that compiled it, started with --enable-preview, and the page says so.
Constant pool strings
Every text literal in a class's code (messages, SQL, URLs, property names, sometimes a hard-coded password) is stored as plain text in its constant pool. Searching the strings is the quickest way to see what a class talks to without decompiling it.