Turn JAR (java archive) into self-contained executable in a single command
Go to file
David 7b7c32f56f
All checks were successful
continuous-integration/drone/push Build is passing
Merge pull request 'Updating README.md and CHANGELOG.md' (#22) from feature/update_readme_file into develop
Reviewed-on: #22
2024-05-20 20:09:24 +02:00
.drone.yml Fixing build pipeline 2024-05-20 17:33:59 +02:00
.gitignore Updating download url for new warp-packer version 2024-05-19 09:48:25 +02:00
CHANGELOG.md Updating README.md and CHANGELOG.md 2024-05-20 19:57:06 +02:00
Dockerfile Cleaning up code and setting temporary download url to develop branch 2024-05-20 18:25:20 +02:00
Dockerfile_x64 Adding CHANGELOG.md and fixing Dockerfile name 2024-05-20 17:20:54 +02:00
INSTALL.md Cleaning up code and setting temporary download url to develop branch 2024-05-20 18:25:20 +02:00
install.sh Cleaning up code and setting temporary download url to develop branch 2024-05-20 18:25:20 +02:00
README.md Updating README.md and CHANGELOG.md 2024-05-20 19:57:06 +02:00
warp4j Updating warp-packer call, adding prefix and Spring-Boot support 2024-05-17 22:56:20 +02:00

Warp4j

Turn JAR (java archive) into self-contained executable in a single command.

Features

  • downloads java runtimes automatically
  • makes runtimes optimized for your application
  • creates self-contained binaries for Linux, macOS and Windows using warp-packer
  • works on Linux, macOS and Windows (with Windows Subsystem for Linux)
  • supports cross "compilation"
  • does not require neither JDK nor JRE installed

TL;DR

Just put both warp4j and warp-packer somewhere in your PATH and run warp4j app.jar.

Install

Curl one-liner installs latest versions of both warp4j and warp-packer:

bash -c "$(curl -fsSL https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/install.sh)"

This script will show missing dependencies (if there are any), they must be installed with your package manager.

See more install methods here.

Usage

$ ls
my-app.jar

$ warp4j my-app.jar
...
...
...

$ ls -1
my-app.jar
warped

$ ls warped
my-app-linux-x64
my-app-linux-x64.tar.gz
my-app-macos-x64
my-app-macos-x64.tar.gz
my-app-windows-x64.exe
my-app-windows-x64.zip

See help:

$ wapr4j --help


Usage: warp4j [options] <app.jar>

Turn JAR (java archive) into self-contained executable

Options:
  -j, --java-version   <version>
                       override JDK/JRE version
                       examples: "17", "17.0", "17.0.2", "17.0.2+9"
                       (default: 17)
  -cp, --class-path    <classpath>
                       adds additional classpaths to the jdeps call
  --auto-class-path    extract and get class-path values from jar file
                       ignored when -cp, --class-path is set
  --spring-boot        extract and get class-path values from
                       Spring-Boot application jar file
                       ignored when -cp, --class-path is set
  -o, --output         <directory>
                       override output directory;
                       this is relative to current PWD
                       (default: ./warped)
  -p, --prefix         <prefix>
                       if set, warp-packer will use the prefix
                       as target folder in which the 
                       application should be extracted
  --list               show available java releases;
                       takes into consideration other options:
                       "--java-version", "--no-optimize", "--jvm-impl";
                       the output may be used to specify concrete
                       "--java-version"
  --no-optimize        use JRE instead of optimized JDK;
                       by default jdeps and jlink are used to create
                       optimized JDK for the particular jar;
                       JRE is always used for java 8
  --pull               check if more recent JDK/JRE distro is available;
                       by default latest cached version that matches
                       "--java-version" is used
                       to get the classpath for jdeps call
  --linux              create binary for Linux
  --macos              create binary for macOS
  --windows            create binary for Windows
                       if no targets are specified then binaries for
                       all targets are created
  --jvm-options        <options>
                       passed to java like this:
                       "java <options> -jar <jar file>";
                       use quotes when passing multiple options
                       example: '-Xms512m -Xmx1024m'
  -s, --silent         using javaw instead of java for windows
  -h, --help           show this message

Compatibility

Tested on the following operating systems:

  • Debian 10.8
  • Ubuntu 18.04
  • macOS Mojave
  • Windows Subsystem for Linux with Ubuntu 14.04

Cache Location

Downloaded runtimes and prepared bundles are here:

  • Linux: $HOME/.local/share/warp4j
  • macOS: $HOME/Library/Application Support/warp4j

To override cache path, set WARP4J_CACHE environment variable.