Possible Duplicate:
Tool to read and display Java .class versions
I'm trying to debug a
"Bad version number in .class file'
error in java, is there a way for me to check which version the .class
files are?
I'm using JRE1.5.0_6
, but my JDK
is version 1.6.0_13.
I'm compiling with compatibility mode set to 1.5 in eclipse which I thought would work...
In Java, we can use javap -verbose className to print out the class information. D:\projects>javap -verbose Test Classfile /D:/projects/Test. class Last modified 16 Apr 2019; size 413 bytes MD5 checksum 8679313dc0728e291898ad34656241cb Compiled from "Test.
Description. The javac command reads source files that contain module, package and type declarations written in the Java programming language, and compiles them into class files that run on the Java Virtual Machine. The javac command can also process annotations in Java source files and classes.
You're looking for this on the command line (for a class called MyClass):
On Unix/Linux:
javap -verbose MyClass | grep "major"
On Windows:
javap -verbose MyClass | findstr "major"
You want the major version from the results. Here are some example values:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With