warp4j/README.md

126 lines
3.9 KiB
Markdown
Raw Permalink 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
2024-05-11 09:09:28 +02:00
- creates self-contained binaries for Linux, macOS and Windows using [warp-packer](https://git.phoenix.ipv64.de/public/warp)
2019-02-14 17:08:36 +01:00
- works on Linux, macOS and Windows (with Windows Subsystem for Linux)
- supports cross "compilation"
- does not require neither JDK nor JRE installed
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-16 20:12:03 +01:00
Curl one-liner installs latest versions of both `warp4j` and `warp-packer`:
2019-02-14 18:43:19 +01:00
```
2024-05-20 19:57:06 +02:00
bash -c "$(curl -fsSL https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/install.sh)"
2019-02-14 18:43:19 +01:00
```
2019-02-16 20:12:03 +01:00
This script will show missing dependencies (if there are any), they must be installed with your package manager.
2019-02-01 12:36:40 +01:00
2019-02-16 20:12:03 +01:00
See more install methods [here](INSTALL.md).
2019-02-14 17:08:36 +01:00
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
2019-02-18 15:37:27 +01:00
my-app-linux-x64
2019-02-11 17:19:59 +01:00
my-app-linux-x64.tar.gz
2019-02-18 15:37:27 +01:00
my-app-macos-x64
2019-02-11 17:19:59 +01:00
my-app-macos-x64.tar.gz
2019-02-18 15:37:27 +01:00
my-app-windows-x64.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
2024-05-20 19:57:06 +02:00
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: "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
2024-05-20 19:57:06 +02:00
--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)
2024-05-20 19:57:06 +02:00
-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"
2019-02-14 17:08:36 +01:00
--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
2019-02-18 15:37:27 +01:00
optimized JDK for the particular jar;
2019-02-11 17:19:59 +01:00
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
2024-05-20 19:57:06 +02:00
to get the classpath for jdeps call
2019-02-16 16:47:37 +01:00
--linux create binary for Linux
--macos create binary for macOS
--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-options <options>
passed to java like this:
2019-02-18 15:37:27 +01:00
"java <options> -jar <jar file>";
2019-02-14 17:08:36 +01:00
use quotes when passing multiple options
example: '-Xms512m -Xmx1024m'
-s, --silent using javaw instead of java for windows
2019-02-13 12:08:47 +01:00
-h, --help show this message
2024-05-20 19:57:06 +02:00
2019-02-01 12:36:40 +01:00
```
2019-02-14 17:08:36 +01:00
## Compatibility
Tested on the following operating systems:
2024-05-20 21:47:21 +02:00
- Debian 12.5
2019-02-14 17:08:36 +01:00
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`
2019-02-18 15:37:27 +01:00
To override cache path, set `WARP4J_CACHE` environment variable.