Compare commits

..

No commits in common. "36c4b20cb83949507e1b92462cc9ca9e39d7be19" and "277a896f16a449c1cb6b6ea98c9a98059913460d" have entirely different histories.

3 changed files with 79 additions and 109 deletions

View File

@ -6,21 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [Unreleased]
### Changed
- Improved macOS runnable execution in the tar.gz file. The executable file is now placed inside a folder named `application.app`, allowing it to be launched with a double-click.
## [v1.0.0] - 2024-05-20 ## [1.0.0] - 2024-05-20
### Changed ### Added
- Script warp4j improved to support running on aarch64 architecture
- Install script improved to run with /bin/sh - Install script improved to run with /bin/sh
- Dockerfile changed to use install.sh script (Works on x64 and aarch64 architecture) - Dockerfile changed to use install.sh script (Works on x64 and aarch64 architecture)
### Added
- Dockerfile_x64 with old build script for tests - Dockerfile_x64 with old build script for tests
- Script warp4j improved to support to run on aarch64 architecture
## [origin warp4j] - 2019-02-28 ## [origin warp4j] - 2019-02-28
- See origin repository: https://github.com/guziks/warp4j - See origin repository: https://github.com/guziks/warp4j
[unreleased]: https://git.phoenix.ipv64.de/public/warp4j/compare/master...HEAD [unreleased]: https://git.phoenix.ipv64.de/public/warp4j/compare/master...HEAD
[v1.0.0]: https://git.phoenix.ipv64.de/public/warp4j/compare/stable...v1.0.0 [1.0.0]: https://git.phoenix.ipv64.de/public/warp4j/compare/stable...master
[origin warp4j]: https://github.com/guziks/warp4j [origin warp4j]: https://github.com/guziks/warp4j

106
README.md
View File

@ -4,12 +4,12 @@ Turn JAR (java archive) into self-contained executable in a single command.
## Features ## Features
- Downloads Java runtimes automatically - downloads java runtimes automatically
- Makes runtimes optimized for your application - 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) - 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) - works on Linux, macOS and Windows (with Windows Subsystem for Linux)
- Supports cross "compilation" - supports cross "compilation"
- Does not require either JDK or JRE installed - does not require neither JDK nor JRE installed
## TL;DR ## TL;DR
@ -17,19 +17,19 @@ Just put both `warp4j` and `warp-packer` somewhere in your PATH and run `warp4j
## Install ## Install
Curl one-liner installs the latest versions of both `warp4j` and `warp-packer`: Curl one-liner installs latest versions of both `warp4j` and `warp-packer`:
```sh ```
bash -c "$(curl -fsSL https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/install.sh)" 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. This script will show missing dependencies (if there are any), they must be installed with your package manager.
See more install methods [here](INSTALL.md). See more install methods [here](INSTALL.md).
## Usage ## Usage
```sh ```
$ ls $ ls
my-app.jar my-app.jar
@ -53,84 +53,62 @@ my-app-windows-x64.zip
See help: See help:
```sh ```
$ warp4j --help $ wapr4j --help
Usage: warp4j [options] <app.jar> Usage: warp4j [options] <app.jar>
Turn JAR (java archive) into a self-contained executable Turn JAR (java archive) into self-contained executable
Options: Options:
-j, --java-version <version> -j, --java-version <version>
Override JDK/JRE version override JDK/JRE version
Examples: "17", "17.0", "17.0.2", "17.0.2+9" examples: "17", "17.0", "17.0.2", "17.0.2+9"
(default: 17) (default: 17)
-cp, --class-path <classpath> -cp, --class-path <classpath>
Adds additional classpaths to the jdeps call adds additional classpaths to the jdeps call
--auto-class-path Extract and get class-path values from jar file --auto-class-path extract and get class-path values from jar file
Ignored when -cp, --class-path is set ignored when -cp, --class-path is set
--spring-boot Extract and get class-path values from --spring-boot extract and get class-path values from
Spring-Boot application jar file Spring-Boot application jar file
Ignored when -cp, --class-path is set ignored when -cp, --class-path is set
-o, --output <directory> -o, --output <directory>
Override output directory; override output directory;
This is relative to current PWD this is relative to current PWD
(default: ./warped) (default: ./warped)
-p, --prefix <prefix> -p, --prefix <prefix>
If set, warp-packer will use the prefix if set, warp-packer will use the prefix
as target folder in which the as target folder in which the
application should be extracted application should be extracted
--list Show available java releases; --list show available java releases;
Takes into consideration other options: takes into consideration other options:
"--java-version", "--no-optimize", "--jvm-impl"; "--java-version", "--no-optimize", "--jvm-impl";
The output may be used to specify concrete the output may be used to specify concrete
"--java-version" "--java-version"
--no-optimize Use JRE instead of optimized JDK; --no-optimize use JRE instead of optimized JDK;
By default jdeps and jlink are used to create by default jdeps and jlink are used to create
optimized JDK for the particular jar; optimized JDK for the particular jar;
JRE is always used for java 8 JRE is always used for java 8
--pull Check if more recent JDK/JRE distro is available; --pull check if more recent JDK/JRE distro is available;
By default latest cached version that matches by default latest cached version that matches
"--java-version" is used "--java-version" is used
--linux Create binary for Linux to get the classpath for jdeps call
--macos Create binary for macOS --linux create binary for Linux
--windows Create binary for Windows --macos create binary for macOS
If no targets are specified then binaries for --windows create binary for Windows
if no targets are specified then binaries for
all targets are created all targets are created
--jvm-options <options> --jvm-options <options>
Passed to java like this: passed to java like this:
"java <options> -jar <jar file>"; "java <options> -jar <jar file>";
Use quotes when passing multiple options use quotes when passing multiple options
Example: '-Xms512m -Xmx1024m' example: '-Xms512m -Xmx1024m'
-s, --silent Using javaw instead of java for windows -s, --silent using javaw instead of java for windows
-h, --help Show this message -h, --help show this message
``` ```
### 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.
## Compatibility ## Compatibility
Tested on the following operating systems: Tested on the following operating systems:

66
warp4j
View File

@ -4,52 +4,53 @@ function print_help {
echo echo
echo 'Usage: warp4j [options] <app.jar>' echo 'Usage: warp4j [options] <app.jar>'
echo echo
echo 'Turn JAR (java archive) into a self-contained executable' echo 'Turn JAR (java archive) into self-contained executable'
echo echo
echo 'Options:' echo 'Options:'
echo ' -j, --java-version <version>' echo ' -j, --java-version <version>'
echo ' Override JDK/JRE version' echo ' override JDK/JRE version'
echo ' Examples: "17", "17.0", "17.0.2", "17.0.2+9"' echo ' examples: "17", "17.0", "17.0.2", "17.0.2+9"'
echo ' (default: 17)' echo ' (default: 17)'
echo ' -cp, --class-path <classpath>' echo ' -cp, --class-path <classpath>'
echo ' Adds additional classpaths to the jdeps call' echo ' adds additional classpaths to the jdeps call'
echo ' --auto-class-path Extract and get class-path values from jar file' echo ' --auto-class-path extract and get class-path values from jar file'
echo ' Ignored when -cp, --class-path is set' echo ' ignored when -cp, --class-path is set'
echo ' --spring-boot Extract and get class-path values from' echo ' --spring-boot extract and get class-path values from'
echo ' Spring-Boot application jar file' echo ' Spring-Boot application jar file'
echo ' Ignored when -cp, --class-path is set' echo ' ignored when -cp, --class-path is set'
echo ' -o, --output <directory>' echo ' -o, --output <directory>'
echo ' Override output directory;' echo ' override output directory;'
echo ' This is relative to current PWD' echo ' this is relative to current PWD'
echo ' (default: ./warped)' echo ' (default: ./warped)'
echo ' -p, --prefix <prefix>' echo ' -p, --prefix <prefix>'
echo ' If set, warp-packer will use the prefix' echo ' if set, warp-packer will use the prefix'
echo ' as target folder in which the' echo ' as target folder in which the '
echo ' application should be extracted' echo ' application should be extracted'
echo ' --list Show available java releases;' echo ' --list show available java releases;'
echo ' Takes into consideration other options:' echo ' takes into consideration other options:'
echo ' "--java-version", "--no-optimize", "--jvm-impl";' echo ' "--java-version", "--no-optimize", "--jvm-impl";'
echo ' The output may be used to specify concrete' echo ' the output may be used to specify concrete'
echo ' "--java-version"' echo ' "--java-version"'
echo ' --no-optimize Use JRE instead of optimized JDK;' echo ' --no-optimize use JRE instead of optimized JDK;'
echo ' By default jdeps and jlink are used to create' echo ' by default jdeps and jlink are used to create'
echo ' optimized JDK for the particular jar;' echo ' optimized JDK for the particular jar;'
echo ' JRE is always used for java 8' echo ' JRE is always used for java 8'
echo ' --pull Check if more recent JDK/JRE distro is available;' echo ' --pull check if more recent JDK/JRE distro is available;'
echo ' By default latest cached version that matches' echo ' by default latest cached version that matches'
echo ' "--java-version" is used' echo ' "--java-version" is used'
echo ' --linux Create binary for Linux' echo ' to get the classpath for jdeps call'
echo ' --macos Create binary for macOS' echo ' --linux create binary for Linux'
echo ' --windows Create binary for Windows' echo ' --macos create binary for macOS'
echo ' If no targets are specified then binaries for' echo ' --windows create binary for Windows'
echo ' if no targets are specified then binaries for'
echo ' all targets are created' echo ' all targets are created'
echo ' --jvm-options <options>' echo ' --jvm-options <options>'
echo ' Passed to java like this:' echo ' passed to java like this:'
echo ' "java <options> -jar <jar file>";' echo ' "java <options> -jar <jar file>";'
echo ' Use quotes when passing multiple options' echo ' use quotes when passing multiple options'
echo " Example: '-Xms512m -Xmx1024m'" echo " example: '-Xms512m -Xmx1024m'"
echo ' -s, --silent Using javaw instead of java for windows' echo ' -s, --silent using javaw instead of java for windows'
echo ' -h, --help Show this message' echo ' -h, --help show this message'
exit exit
} }
@ -792,16 +793,11 @@ function warp_targets() {
--output "$WARPED_TEMP_PATH/$MAC/$APP_NAME" \ --output "$WARPED_TEMP_PATH/$MAC/$APP_NAME" \
&> /dev/null &> /dev/null
fail_if $? "Failed to warp for $MAC" fail_if $? "Failed to warp for $MAC"
echo "Creating runnable $MAC application bundle"
mkdir "$WARPED_TEMP_PATH/$MAC/$APP_NAME.app"
cp "$WARPED_TEMP_PATH/$MAC/$APP_NAME" "$WARPED_TEMP_PATH/$MAC/$APP_NAME.app"
echo "Archiving for $MAC..." echo "Archiving for $MAC..."
tar -C "$WARPED_TEMP_PATH/$MAC" -czf "$WARPED_TEMP_PATH/$APP_NAME-$MAC-x64.tar.gz" "$APP_NAME.app" tar -C "$WARPED_TEMP_PATH/$MAC" -czf "$WARPED_TEMP_PATH/$APP_NAME-$MAC-x64.tar.gz" "$APP_NAME"
fail_if $? "Failed to make archive for $MAC" fail_if $? "Failed to make archive for $MAC"
mv "$WARPED_TEMP_PATH/$APP_NAME-$MAC-x64.tar.gz" "$WARPED_PATH/"
mv "$WARPED_TEMP_PATH/$MAC/$APP_NAME" "$WARPED_PATH/$APP_NAME-$MAC-x64" mv "$WARPED_TEMP_PATH/$MAC/$APP_NAME" "$WARPED_PATH/$APP_NAME-$MAC-x64"
rm "$WARPED_TEMP_PATH/$MAC/$APP_NAME.app/$APP_NAME" mv "$WARPED_TEMP_PATH/$APP_NAME-$MAC-x64.tar.gz" "$WARPED_PATH"
rmdir "$WARPED_TEMP_PATH/$MAC/$APP_NAME.app"
rmdir "$WARPED_TEMP_PATH/$MAC" rmdir "$WARPED_TEMP_PATH/$MAC"
fi fi