3

I have a java jar file. How can I check with which version of java , the jar file got created which build was performed. There was a recent Java upgrade happened on my system from Java Version 1.6 to Java version 1.8 and a Jar file stopped working.

Dileep Dominic
  • 499
  • 11
  • 23

1 Answers1

3

On Linux, Mac OS X or Windows with Cygwin installed, the file(1) command knows the class version.

$ file ./org/apache/log4j/Appender.class
./org/apache/log4j/Appender.class: compiled Java class data, version 45.3

And if you are relegated to a Windows environment without either file or grep

> javap -v ./org/apache/log4j/Appender.class | findstr major
 major version: 45

Reference: What version of javac built my jar?

Vishwa Ratna
  • 5,567
  • 5
  • 33
  • 55