← Back to list

Find Java Version From Compiled Class Files

Learn how to easily identify the Java version from compiled class files using the “Javap” tool.

Rakshit Shah in BeingCoders · 2023-09-23 09:14 · 81 claps · 2.9 min read paywalled
#technology #java #java-class-file #jdk-tools #javap
Open on Medium ↗

Find Java Version From Compiled Class Files

Learn how to easily identify the Java version from compiled class files using the “Javap” tool.

Image by Author via 9Mood | Made with MS PowerPoint

Image by Author via 9Mood | Made with MS PowerPoint

You can check the Java version from which class files were compiled using the javap tool, which is included with the Java Development Kit (JDK).

TL;DR

In this article, you will learn about all the major versions of the Java/JDK class file, for example, Java 8 (52 major version), Java 11 (55 major version), Java 17 (61 major version), and Java 18 (62 major version).

javap is a command-line utility that pulls apart class files and provides information about the bytecode, including the version number.

  1. Make sure any JDK version is installed at least in your machine first, then Open a command prompt or terminal window.
  2. Navigate to the directory where the class file is located for your project, using the cd command (change directory). Usually, it can be found under the bin or target folder.
  3. Now run the following command:
javap -verbose ClassName
  1. Replace ClassName with the name of the class file (without the .class extension) and hit the enter button.

For example, if I have a HelloWorld.class file in my bin or target folder, I would hit the following command in the terminal to know the Java version of this file.

javap -verbose HelloWorld

Game of Major Versions in Java

I will directly show you the practical scenario for finding your class files compiled through which version of java. For my current class "EmpDashboardController.java" file I compiled it through my X version of Java, Now I have to figure out what JDK version was used to compile this file!

javap command using cmd to find te java file version | Image by Author

javap command using cmd to find te java file version | Image by Author

I will hit the command “javap -verbose EmpDashboardController” directly.

Look for the “major version” field in the output. This field indicates the Java version from which the class file was compiled. The major version number corresponds to a specific Java version.

In my example, it is showing, major version 55.

Major versions list

Here are some common major versions found in different java versions for your reference. You can find the major version against existing JDK versions in the below table.

+--------------+------------------+
| JAVA VERSION | MAJOR VERSION    |
+--------------+------------------+
| Java 1.0     | 45               |
| Java 1.1     | 45               |
| Java 1.2     | 46               |
| Java 1.3     | 47               |
| Java 1.4     | 48               |
| Java 5       | 49               |
| Java 6       | 50               |
| Java 7       | 51               |
| Java 8       | 52               |
| Java 9       | 53               |
| Java 10      | 54               |
| Java 11      | 55               |
| Java 12      | 56               |
| Java 13      | 57               |
| Java 14      | 58               |
| Java 15      | 59               |
| Java 16      | 60               |
| Java 17      | 61               |
| Java 18      | 62               |
| Java 19      | 63               |
| Java 20      | 64               |
| Java 21      | 65               |
+--------------+------------------+

Table: Java Versions vs Major Versions | Generated by Author Rakshit Shah

Wrapping up…

The major version number will tell you which version of Java was used to compile the class file using the javap command. Just note that, If the major version is not recognized or is greater than the highest version listed here, it likely means that a more recent version of Java was used for compilation.

References:

[1]. Javap — Oracle docs

[2]. Java Class File — Wikipedia

[3]. Find Java Version From Compiled Class Files — 9Mood

Comment your thoughts about javap below!

Feel free to write any questions.

BeingCoders Publication

👏 Before you leave, Appreciate Author’s Effort by clapping on their story👨‍💼 Follow the Author to hear back more from him/her 📰 Knowledge shared | knowledge multiplied 🚀 , follow **BeingCoders Publication. ✍ Write some feedback or your opinion about the story. ✌ Follow us on [Facebook](https://www.facebook.com/9MoodOfficial/) | Twitter | Instagram. **Read More content at Beingcoders.


메타데이터
post_id
7feb99ca2f74
slug
find-java-version-from-compiled-class-files-7feb99ca2f74
url
https://medium.com/beingcoders/find-java-version-from-compiled-class-files-7feb99ca2f74
canonical_url
https://medium.com/beingcoders/find-java-version-from-compiled-class-files-7feb99ca2f74
author_url
https://medium.com/@thundersoul
status
ok
fetched_at
2026-07-25 05:01:28