How to include "arbitrary" jar in export

I have (for good reasons) a jar in my bootclasspath classpath (-Xbootclasspath/a:${repo;...;latest}). When I “export” the project, this jar isn’t included in the generated “fat” jar (quite understandably).

Does anybody know how I can make bnd include this in the generated jar? And, of course, in such a way that the -Xbootclasspath can find the jar? Obviously, I cannot add it to the -runpath


You can include any resource in the export with -includeresource. But you would need to extract the jar from the export before starting the JVM so that the bootclasspath option can reference the jar file.

Thanks. Seems like I need a wrapper shell script . But unless the VM created by java -jar ... started another VM, there is no other way, when you think about it.

Notice that the executable jar already contains shell scripts for windows and *nix.

A little known feature is that if you start your executable jar with the -extract [<where>] command line argument it will extract itself.

It should be easy to add a custom script + the boot class path jars into the executable jar so you can then run the executable from the file system.