warp4j/README.md

117 lines
3.1 KiB
Markdown
Raw Normal View History

2019-02-01 12:36:40 +01:00
# Warp4j
2019-02-14 17:08:36 +01:00
Turn JAR (java archive) into self-contained executable in a single command.
2019-02-01 12:36:40 +01:00
## Features
2019-02-14 17:08:36 +01:00
- downloads java runtimes automatically
- makes runtimes optimized for your application
2019-02-13 12:08:47 +01:00
- creates self-contained binaries for Linux, macOS and Windows using [warp-packer](https://github.com/dgiagio/warp)
2019-02-14 17:08:36 +01:00
- works on Linux, macOS and Windows (with Windows Subsystem for Linux)
- supports cross "compilation"
2019-02-01 12:36:40 +01:00
2019-02-11 17:19:59 +01:00
## TL;DR
Just put both `warp4j` and `warp-packer` somewhere in your PATH and run `warp4j app.jar`.
2019-02-01 12:36:40 +01:00
## Install
2019-02-14 18:43:19 +01:00
### One-liner
Installs latest versions of both `warp4j` and `warp-packer`:
```
$ eval "$(curl -fsSL https://raw.githubusercontent.com/guziks/warp4j/master/install)"
```
### Manual
2019-02-14 17:08:36 +01:00
First install [warp-packer](https://github.com/dgiagio/warp/releases) and ensure other common tools available: `awk`, `curl`, `grep`, `sed`, `sort`, `tar`, `unzip`, optional: `zip`. Then install `warp4j` like this:
2019-02-11 17:19:59 +01:00
2019-02-11 17:38:27 +01:00
```
2019-02-11 17:19:59 +01:00
$ LOCATION=/usr/local/bin \
LINK=https://raw.githubusercontent.com/guziks/warp4j/master/warp4j \
TEMP_LOCATION=/tmp/warp4j \
bash -c 'curl -fsSL -o $TEMP_LOCATION $LINK && \
2019-02-11 17:19:59 +01:00
chmod 755 $TEMP_LOCATION && \
sudo mkdir -p $LOCATION && \
sudo mv $TEMP_LOCATION $LOCATION/warp4j'
2019-02-11 17:19:59 +01:00
```
2019-02-01 12:36:40 +01:00
2019-02-14 17:08:36 +01:00
Previous command can be also used to upgrade to the latest version.
2019-02-01 12:36:40 +01:00
## Usage
2019-02-11 17:38:27 +01:00
```
2019-02-01 12:36:40 +01:00
$ ls
my-app.jar
$ warp4j my-app.jar
...
...
...
2019-02-01 21:01:53 +01:00
$ ls -1
my-app.jar
warped
$ ls warped
my-app-linux
2019-02-11 17:19:59 +01:00
my-app-linux-x64.tar.gz
my-app-macos
my-app-macos-x64.tar.gz
2019-02-01 21:01:53 +01:00
my-app-windows.exe
2019-02-11 17:19:59 +01:00
my-app-windows-x64.zip
2019-02-01 21:01:53 +01:00
```
See help:
2019-02-11 17:38:27 +01:00
```
2019-02-01 21:01:53 +01:00
$ wapr4j --help
2019-02-11 17:19:59 +01:00
Usage: warp4j [options] <app.jar>
2019-02-12 16:49:16 +01:00
Turn JAR (java archive) into self-contained executable
2019-02-11 17:19:59 +01:00
Options:
-j, --java-version <version>
override JDK/JRE version
examples: "11", "11.0", "11.0.2", "11.0.2+9"
2019-02-14 17:08:36 +01:00
(default: 11)
--no-optimize use JRE instead of optimized JDK;
2019-02-11 17:19:59 +01:00
by default jdeps and jlink are used to create
optimized JDK for the partiular jar,
JRE is always used for java 8
2019-02-14 17:08:36 +01:00
--pull check if more recent JDK/JRE distro is available;
2019-02-11 17:19:59 +01:00
by default latest cached version that matches
"--java-version" is used
--target-linux create binary for Linux
--target-macos create binary for macOS
--target-windows create binary for Windows
2019-02-14 17:08:36 +01:00
if no targets are specified then binaries for
all targets are created
2019-02-11 17:19:59 +01:00
--jvm-impl jvm implementation: hotspot or openj9
2019-02-14 17:08:36 +01:00
(default: hotspot)
2019-02-11 17:19:59 +01:00
--jvm-options <options>
passed to java like this:
"java <options> -jar <jar file>"
2019-02-14 17:08:36 +01:00
use quotes when passing multiple options
example: '-Xms512m -Xmx1024m'
2019-02-13 12:08:47 +01:00
-h, --help show this message
2019-02-01 12:36:40 +01:00
```
2019-02-14 17:08:36 +01:00
## Compatibility
Tested on the following operating systems:
- Ubuntu 18.04
- macOS Mojave
- Windows Subsystem for Linux with Ubuntu 14.04
2019-02-01 12:36:40 +01:00
## Cache Location
2019-02-11 17:19:59 +01:00
Downloaded runtimes and prepared bundles are here:
2019-02-01 12:36:40 +01:00
2019-02-11 17:19:59 +01:00
- Linux: `$HOME/.local/share/warp4j`
- macOS: `$HOME/Library/Application Support/warp4j`