Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (3.9k points)

How can I tell what version of the Java compiler was used to build a jar? I have a jar file, and it could have been built in any one of three JDKs. We need to know exactly which one, so we can certify compatibility. Is the compiler version embedded somewhere in the class files or jar?

1 Answer

0 votes
by (46k points)

You can't tell of the JAR file itself, certainly.

Download a hex editor and open one of the class lists inside the JAR and see at byte offsets 4 through 7. The version information is built in.

http://en.wikipedia.org/wiki/Java_class_file

those bytes tell you what version the class has been compiled FOR, not what version compiled it.

Related questions

0 votes
1 answer
asked Sep 23, 2019 in Java by Ritik (3.5k points)
0 votes
1 answer
asked Oct 17, 2019 in Java by Shubham (3.9k points)
0 votes
1 answer
asked Jul 11, 2019 in Java by Ritik (3.5k points)
0 votes
1 answer
0 votes
1 answer
asked Nov 13, 2019 in Java by Anvi (10.2k points)

Browse Categories

...