Monday, November 1, 2010

[Java] Jars inside Jar

Jar that contains multiple jars inside is not support directly by Java. There are some workarounds on this.
  • Put jars in to jar as ordinary files then load them with your own customized classloader. There is a tool such as One-JAR™ but some people told that it causes performance problem (I have not try this).
  • Extract jars to .class and pack them together to a single jar. You can archive this easily with Ant's Zip Task
For me, I choose the second approach. There are more workarounds in reference links below.

Java: Easiest way to merge a release into one jar-file
Is it possible to package all the jar dependencies in one big jar ?

No comments:

[PostgreSQL] How to create read-only standby replica (follower)

This link  and this link explain it really well and concise