Search code examples
javajarmeta-inf

Can META-INF be used in an exploded classes folder (e.g. not within a JAR)?


I would like to overide the META-INF/services there, will it work without a jar?


Solution

  • Yes, you can use META-INF/services without a jar file. At least that's what happens according to my test (Java 6).

    The META-INF directory of all jar files and all directories in the classpath can be scanned independently, so technically such a META-INF file doesn't override the file from another jar file, but (depending on the loader mechanism) entries in one of the files (resource of one of the class loaders) may have priority over other files, so in fact you can overload entries. As you already found out, one such case is javax.xml.datatype.FactoryFinder (I didn't know that).