Java Class Restorer is a utility for scanning binary files, directories, or JAR archives to locate and restore embedded Java .class
files.
It detects the standard Java class file magic number (0xCAFEBABE
), attempts to reconstruct valid class definitions using ASM, and writes the recovered classes into a new JAR file.
- Java 24 (JDK 24 or newer)
- The provided JAR already contains all required libraries — no additional downloads are needed.
- Any modern IDE (IntelliJ IDEA
.iml
project file is included) or command line.
From the command line:
java -jar jcr-.jar <input_file|dir|jar> [output_jar] [max_class_size] [package_filter]
Argument | Required | Description |
---|---|---|
input_file/dir/jar |
Yes | Path to a file, directory, or JAR to scan. |
output_jar |
No | Output JAR file name/path. Defaults to <input>-restored.jar . |
max_class_size |
No | Maximum class size in bytes to attempt restoring. Default: 20480 . |
package_filter |
No | Only restore classes whose internal name starts with this package (dot or slash notation). |
Restore classes from a JAR:
java -jar java-class-restorer.jar input.jar
Restore from a binary dump, limit class size to 10 KB, and filter to com.example
package:
java -jar java-class-restorer.jar dump.bin restored.jar 10240 com.example
Scan a directory recursively:
java -jar java-class-restorer.jar ./data
- Restored JAR — contains all successfully reconstructed
.class
files. - restore.log — detailed log of the process, including:
- Found magic signatures
- Restored class names
- Skipped duplicates
- Errors and warnings
- This project is configured for Java 24. Make sure your
JAVA_HOME
points to JDK 24. - All dependencies are already included in the JAR — you can run it directly without building.
- The
.iml
file is provided for IntelliJ IDEA users; simply open the project and runApp.main()
.
MIT License — see LICENSE
for details.