| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A Perl utility to extract Java version information from compiled Java class files by analyzing their bytecode headers.
JavaInfo reads Java .class files and identifies the Java version used to compile them. It works by examining the bytecode header of each class file, specifically the magic number (0xCAFEBABE) and the major/minor version numbers that indicate the Java compiler version.
The tool can process individual files or recursively scan entire directories, making it useful for:
chmod +x JavaInfosudo cp JavaInfo /usr/local/bin/./JavaInfo <file or directory> [<file or directory> ...]Analyze a single class file:
./JavaInfo MyClass.classScan a directory recursively:
./JavaInfo /path/to/project/target/classesProcess multiple paths:
./JavaInfo src/main/java build/classes lib/*.jarMyClass.class: Java 11 [0/55]
Utils.class: Java 8 [0/52]
LegacyCode.class: Java 1.4.2 [0/48]
The output format is:
<filename>: Java <version> [<minor>/<major>]
Where:
The tool uses the following mapping between bytecode major versions and Java releases:
| Major Version | Minor Version | Java Version |
|---|---|---|
| 45 | 0-3 | 1.0.2 |
| 45 | 4+ | 1.1.8 |
| 46 | - | 1.2.2 |
| 47 | - | 1.3.1 |
| 48 | - | 1.4.2 |
| 49 | - | 5 |
| 50 | - | 6 |
| 51 | - | 7 |
| 52 | - | 8 |
| ... | - | ... |
For Java 5 and later, the formula is: Java Version = Major Version - 44
The script will display error messages and exit if:
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
See LICENSE file for details.
For security concerns, please see SECURITY.md.
This project adheres to a code of conduct. See CODE_OF_CONDUCT.md for details.
| Back | FazBrowse Home | New Git URL |