Do any of you know of a tool that will search for .class files and then display their compiled versions?
I know you can look at them individually in a hex editor but I have a lot of class files to look over (something in my giant application is compiling to Java6 for some reason).
Use the javap tool that comes with the JDK. The -verbose
option will print the version number of the class file.
> javap -verbose MyClass
Compiled from "MyClass.java"
public class MyClass
SourceFile: "MyClass.java"
minor version: 0
major version: 46
...
To only show the version:
WINDOWS> javap -verbose MyClass | find "version"
LINUX > javap -verbose MyClass | grep version