Skip to content

launcher that starts the main class specified in a JAR while preserving the CLASSPATH

License

Notifications You must be signed in to change notification settings

0install/jar-launcher

Repository files navigation

JAR Launcher

A launcher that starts the main class specified in a JAR while preserving the CLASSPATH.
Workaround for java -classpath ... -jar ... which does not work.

This is useful for injecting dependencies at runtime, e.g. when using Zero Install.

Build status

Building

Run mvn package to generate target/jar-launcher-X.Y.jar.

Usage

You can manually invoke jar-launcher like this:

java -classpath target/jar-launcher-X.Y.jar:Application.jar:/directory/containing/library net.zeroinstall.jar.launcher.JarLauncher Application.jar

Note: Using jar-launcher disables all the default classpath handling for JARs. Therefore, the classpath must explicitly list the jar-launcher JAR and the Application JAR.

jar-launcher is usually used in Zero Install feeds like this:

<command name="run" path="Application.jar" />
	<runner interface="https://apps.0install.net/java/jar-launcher.xml" />
</command>
<environment name="CLASSPATH" insert="Application.jar" />
<requires interface="http://some/library.xml">
	<environment name="CLASSPATH" insert="Library.jar" />
</requires>

About

launcher that starts the main class specified in a JAR while preserving the CLASSPATH

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages