What version of javac built my jar?

前端 未结 20 926
孤街浪徒
孤街浪徒 2020-11-27 09:48

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

20条回答
  •  隐瞒了意图╮
    2020-11-27 10:32

    To expand on Jonathon Faust's and McDowell's answers: If you're on a *nix based system, you can use od (one of the earliest Unix programs1 which should be available practically everywhere) to query the .class file on a binary level:

    od -An -j7 -N1 -t dC SomeClassFile.class
    

    This will output the familiar integer values, e.g. 50 for Java 5, 51 for Java 6 and so on.

    1 Quote from https://en.wikipedia.org/wiki/Od_(Unix)

提交回复
热议问题