How do I include external JARs in my own Project JAR

前端 未结 6 1252
无人共我
无人共我 2021-02-20 07:26

I have a Java application and created a JAR file and deployed it.

The App uses external JARs such as the Log4J JAR. When creating my JAR file, how do I include all ext

6条回答
  •  借酒劲吻你
    2021-02-20 07:59

    A JAR is not itself capable of nesting other JARs, as you discovered.

    Traditionally, one would distribute a ZIP archive or other installer that would unwind the application JAR (yours) as well as any support JARs in the appropriate location for classpath access. Frequently, then, the application was invoked through a script that invoked the primary JAR and created a classpath that listed the support JARs.

    As other posters have noted, you have some options to create a super-JAR if that's what you want.

提交回复
热议问题