Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


One-Jar and service loader

  • Hello,

    I'm experiencing a problem while packaging a Java application with One-Jar in which a dependency JAR uses the Java ServiceLoader mechanism to provide its service.

    In short, when this JAR it is embedded in the One-Jar packaged app the the service it is not loaded (apparently the class-loader it is unable to access the META-INF/services/descriptor file in the embedded JAR).

    Is there any way or workaround to handle this?

    Best and thanks for your tool.

  • Tom Eugelink
    Tom Eugelink

    Same problem here.

  • Gus Heck
    Gus Heck

    Seems this is likely to be related to my recently reported issue: https://sourceforge.net/p/one-jar/bugs/75/

    You might try promoting the services descriptor to the top level of the onejar as a workaround. That worked for my use case (though I'm not using ServiceLoader so YMMV)