What version of javac built my jar?

前端 未结 20 817
孤街浪徒
孤街浪徒 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:49

    Following up on @David J. Liszewski's answer, I ran the following commands to extract the jar file's manifest on Ubuntu:

    # Determine the manifest file name:
    $ jar tf LuceneSearch.jar | grep -i manifest
    META-INF/MANIFEST.MF
    
    # Extract the file:
    $ sudo jar xf LuceneSearch.jar META-INF/MANIFEST.MF
    
    # Print the file's contents:
    $ more META-INF/MANIFEST.MF
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.8.2
    Created-By: 1.7.0_25-b30 (Oracle Corporation)
    Main-Class: org.wikimedia.lsearch.config.StartupManager
    
    0 讨论(0)
  • 2020-11-27 10:49

    I build a little bash script (on github) based on Davids suggestion using the file command

    0 讨论(0)
提交回复
热议问题