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.
To load classes in JAR files within a JAR file into the class path, you must write custom code to load those classes. For example, if MyJar. jar contains another JAR file called MyUtils. jar, you cannot use the Class-Path header in MyJar.
A multi-release JAR file allows for a single JAR file to support multiple major versions of Java platform releases. For example, a multi-release JAR file can depend on both the Java 8 and Java 9 major platform releases, where some class files depend on APIs in Java 8 and other class files depend on APIs in Java 9.
In general, to include all of the JARs in a given directory, you can use the wildcard * (not *. jar ). The wildcard only matches JARs, not class files; to get all classes in a directory, just end the classpath entry at the directory name.
Another option is to use a custom class loader such as this one:
http://one-jar.sourceforge.net/
Merge your jars to one jar. See this thread.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With