warp4j/README.md

150 lines
5.0 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
- Downloads Java runtimes automatically
- Makes runtimes optimized for your application
- Creates self-contained binaries for Linux, macOS, and Windows using [warp-packer](https://git.phoenix.ipv64.de/public/warp)
- Works on Linux, macOS, and Windows (with Windows Subsystem for Linux)
- Supports cross "compilation"
- Does not require either JDK or 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
Curl one-liner installs the latest versions of both `warp4j` and `warp-packer`:
2019-02-14 18:43:19 +01:00
```sh
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
```
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
```sh
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:
```sh
$ warp4j --help
2024-05-20 19:57:06 +02:00
2019-02-11 17:19:59 +01:00
Usage: warp4j [options] <app.jar>
Turn JAR (java archive) into a 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
--spring-boot Extract and get class-path values from
2024-05-20 19:57:06 +02:00
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
2024-05-20 19:57:06 +02:00
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"
--add-modules A list of additional java modules that should
be added to the optimized JDK. Separate each
module with commas and no spaces
--no-optimize Use JRE instead of optimized JDK;
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
--pull Check if more recent JDK/JRE distro is available;
By default latest cached version that matches
2019-02-11 17:19:59 +01:00
"--java-version" is used
--linux Create binary for Linux
--macos Create binary for macOS
--windows Create binary for Windows
If no targets are specified then binaries for
2019-02-14 17:08:36 +01:00
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>";
Use quotes when passing multiple options
Example: '-Xms512m -Xmx1024m'
-s, --silent Using javaw instead of java for windows
-h, --help Show this message
2019-02-01 12:36:40 +01:00
```
### Running on macOS
For macOS, the executable is placed inside a folder with the `.app` extension within the tar.gz file. This allows the application to be launched with a double-click.
To run the application:
1. **From the Executable**:
- Navigate to the `warped` folder.
- Find the `my-app-macos-x64` executable.
- Note: Double-clicking on “my-app-macos-x64” does not work directly because macOS does not know which program to use to open the application.
- To run it, open the terminal and navigate to the `warped` folder:
```sh
cd /path/to/warped
```
- Run the executable from the terminal:
```sh
./my-app-macos-x64
```
2. **From the tar.gz File**:
- Extract the `my-app-macos-x64.tar.gz` file.
- Navigate to the extracted folder: `my-app-macos-x64`.
- You will find a folder named `my-app.app`. For macOS this is now an executable file.
- Double-click on `my-app.app` to run the application.
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.