/java-tool-launcher

Java application/ToolProvider launcher with @argfile support

Primary LanguageScalaMIT LicenseMIT

Java tool launcher

Travis (.com) Maven Central

A self-contained launcher for Java applications, providing @argfile support.

Motivation

  • Some use cases for Java tools require passing a large command line, which can reach the size limit on Windows (or even on Linux). There are workarounds in some scenarios (e.g. using classpath jars, or built-in @argfile support), but not in general.
  • In some build systems (e.g. SBT), using tools from another JVM is more difficult than running java or javac.

Features

  • Supports launching main classes.
  • Supports launching ToolProvider tools (requires JVM 9 or higher).
  • Supports @argfiles.

Syntax

Launch a main class:

$ java -cp my-app.jar -jar tool-launcher.jar -main my.App <args>

Launch a Java tool:

$ java -jar tool-launcher.jar -tool jdeps my-app.jar

Expand an @argfile:

$ java -jar tool-launcher.jar -tool jdeps @my-args.txt

Escape an argument starting with @ (for bash - this depends on your shell):

$ java -jar tool-launcher.jar -tool javac '\@foo'

Requirements

  • JVM 8+ for running;
  • JVM 9+ for ToolProvider support;
  • JVM 11+ for building.

Releasing/publishing

  • This is versioned via sbt-dynver.
  • This is published to Sonatype - you would need to set up your environment as described here