File types / Programs & scripts
.class file
Java class file
- Extensions
- .class
- MIME type
application/java-vm- Signature
CA FE BA BEat byte offset 0- Safety
- Can run code
What is a .class file?
A .class file contains compiled Java bytecode. The JVM loads these to run Java programs, and they are usually bundled into JAR files.
The signature CA FE BA BE is also used by macOS universal binaries, so look at the next bytes to tell them apart.
Used for: Compiled Java code.
How can I tell if a file is really a CLASS?
Read its first bytes rather than trusting the name. A genuine CLASS file has the signature CA FE BA BE at byte offset 0. The File Identity tool reads these bytes in your browser, so the file is never uploaded.
To compare the name against the content, use Validate Extension. To see the raw bytes, use Safe File Preview.
Is a .class file safe to open?
Class files are programs. Run only Java code you trust.
Easy to confuse
The same four bytes mark a multi-architecture macOS binary.