0

I have generated .war or .jar using Java 8 first and then compiled using Java 11.

How can i check from .war or .jar that which java version it has compiled to?

fatherazrael
  • 5,511
  • 16
  • 71
  • 155
  • You can inspect the class files inside of the jar/war archive with `javap`: – f1sh May 19 '22 at 09:48
  • 1
    Do you want to check which version it was compiled with, or do you want to check which version was targeted? Java 11 can target Java 8, so then your code is compiled with Java 11, but will work on Java 8 and higher. Your question title asks the first, while your question body asks the second. – Mark Rotteveel May 19 '22 at 10:14
  • Java 11 build is showing Major as 52 i.e Java 8 but it shall show 55 – fatherazrael May 19 '22 at 10:18
  • 1
    @fatherazrael That is not how it works. If you use javac of Java 11 with -release 8, it will generate class with class version 52, there is no way you can let that case show class version 55, because that is not the class version of the produced artifact. You can usually find out if something was compiled with Java 11 by inspecting the manifest of the JAR, but that could be build-tool specific. – Mark Rotteveel May 20 '22 at 12:53

0 Answers0