Can you add multiple jars in a jar file and then launch that jar file

前端 未结 5 1577
失恋的感觉
失恋的感觉 2020-12-31 17:46

I am working on a GUI application and would rather distribute just one jar as opposed to multiple ones.

Can you control this with the manifest.

相关标签:
5条回答
  • 2020-12-31 18:08

    Another option is to use a custom class loader such as this one:

    http://one-jar.sourceforge.net/

    0 讨论(0)
  • 2020-12-31 18:09

    Have a look here. Use Netbeans 6.7.1 to combine multiple jars into 1 jar

    0 讨论(0)
  • 2020-12-31 18:10

    You need to be careful when doing this. If the jars you are merging have manifest files with critical information - these can get lost, only the last file will get merged.

    E.g. If you merge JavaMail - the manifest file is important. If you lose it - bad things csn happen.

    The safest thing to do is to look at each jar file and check the manifest file.

    0 讨论(0)
  • 2020-12-31 18:24

    Create a Shaded jar which combines multiple jars into a single jar. Maven supports this functionality out of the box.

    https://maven.apache.org/plugins/maven-shade-plugin/

    0 讨论(0)
  • 2020-12-31 18:28

    Merge your jars to one jar. See this thread.

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