reading MANIFEST.MF file from jar file using JAVA

前端 未结 8 1349
情深已故
情深已故 2020-12-02 20:34

Is there any way i can read the contents of a jar file. like i want to read the manifest file in order to find the creator of the jar file and version. Is there any way to a

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 20:49

    You can use a utility class Manifests from jcabi-manifests:

    final String value = Manifests.read("My-Version");
    

    The class will find all MANIFEST.MF files available in classpath and read the attribute you're looking for from one of them. Also, read this: http://www.yegor256.com/2014/07/03/how-to-read-manifest-mf.html

提交回复
热议问题