Jar file ADD DIRECTORY ENTRIES Eclipse option while exporting jar

后端 未结 3 1903
名媛妹妹
名媛妹妹 2020-12-19 05:35

I don\'t whether I am asking correct question or not but want to clear my doubt.

Actually I came across the scenario of referring class files from jar file. I mean to

相关标签:
3条回答
  • 2020-12-19 06:15

    Form Doc JAR File Exporter

    Add directory entries: adds an entry for each directory to the JAR file, even if the directory does only contain subdirectories.

    0 讨论(0)
  • 2020-12-19 06:18

    You should enable "Add directory entries" when creating jar files if you need to use class.getResource() method to get the URI of a particular directory inside your jar file. The reason why you may want to do this is to hold a URI to your "resource" folder for example.

    If you only use class.getResource() to get the URI of a specific file [and not a directory] then you will be fine if you leave the "Add directory entries" off.

    0 讨论(0)
  • 2020-12-19 06:21

    If you look at the jar file with 7-zip or something similar, you can see that there is a "D" attribute for the folders when "Add directory entries" is selected. These attributes do not exist when that that option does not exist. Your compare was probably comparing the contents of the files within the jar file and wasn't looking at the jar file attributes.

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