launcher that starts the main class specified in a JAR while preserving the CLASSPATH
Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/main/java/net/zeroinstall/jar/launcher
.gitignore
.travis.yml
COPYING.txt
README.md
appveyor.yml
jar-launcher.xml
pom.xml

README.md

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.

CI Builds:
Windows Linux

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="http://0install.de/feeds/jar-launcher.xml" />
</command>
<environment name="CLASSPATH" insert="Application.jar" />
<requires interface="http://some/library.xml">
	<environment name="CLASSPATH" insert="Library.jar" />
</requires>