From 7dad79e97af7574a400c3ecf687984503429332a Mon Sep 17 00:00:00 2001 From: david Date: Thu, 30 May 2024 12:35:22 +0200 Subject: [PATCH 1/6] Adding first draft of creating MacOs Application Bundle --- warp4j | 3 +++ 1 file changed, 3 insertions(+) diff --git a/warp4j b/warp4j index c6989c7..87259f7 100755 --- a/warp4j +++ b/warp4j @@ -793,6 +793,9 @@ function warp_targets() { --output "$WARPED_TEMP_PATH/$MAC/$APP_NAME" \ &> /dev/null fail_if $? "Failed to warp for $MAC" + echo "Creating runnable MacOs Application Bundle $APP_NAME.app + 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..." 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" From 0966dd2d2e6ccf7db8e31ad5d3c7be36dc887c02 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 31 May 2024 14:13:32 +0200 Subject: [PATCH 2/6] zip only the app folder without additional execution --- warp4j | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/warp4j b/warp4j index 87259f7..bb7551b 100755 --- a/warp4j +++ b/warp4j @@ -793,14 +793,16 @@ function warp_targets() { --output "$WARPED_TEMP_PATH/$MAC/$APP_NAME" \ &> /dev/null fail_if $? "Failed to warp for $MAC" - echo "Creating runnable MacOs Application Bundle $APP_NAME.app - mkdir $WARPED_TEMP_PATH/$MAC/$APP_NAME.app - cp "$WARPED_TEMP_PATH/$MAC/$APP_NAME $WARPED_TEMP_PATH/$MAC/$APP_NAME.app + 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..." - tar -C "$WARPED_TEMP_PATH/$MAC" -czf "$WARPED_TEMP_PATH/$APP_NAME-$MAC-x64.tar.gz" "$APP_NAME" + tar -C "$WARPED_TEMP_PATH/$MAC" -czf "$WARPED_TEMP_PATH/$APP_NAME-$MAC-x64.tar.gz" "$APP_NAME.app" 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/$APP_NAME-$MAC-x64.tar.gz" "$WARPED_PATH" + rm "$WARPED_TEMP_PATH/$MAC/$APP_NAME.app/$APP_NAME" + rmdir "$WARPED_TEMP_PATH/$MAC/$APP_NAME.app" rmdir "$WARPED_TEMP_PATH/$MAC" fi From 85898ce5f2386b4371715f6b554ee2c3daa6a4d7 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 31 May 2024 15:08:43 +0200 Subject: [PATCH 3/6] Updating CHANGELOG.md, adding infos to README.md and improving help --- CHANGELOG.md | 8 +++- README.md | 108 +++++++++++++++++++++++++++++++-------------------- warp4j | 57 +++++++++++++-------------- 3 files changed, 99 insertions(+), 74 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1eda0e9..8029d46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,17 +6,21 @@ 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). ## [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. ## [1.0.0] - 2024-05-20 ### Added - Install script improved to run with /bin/sh - Dockerfile changed to use install.sh script (Works on x64 and aarch64 architecture) - Dockerfile_x64 with old build script for tests -- Script warp4j improved to support to run on aarch64 architecture + +### Changed +- Script warp4j improved to support running on aarch64 architecture ## [origin warp4j] - 2019-02-28 - See origin repository: https://github.com/guziks/warp4j [unreleased]: https://git.phoenix.ipv64.de/public/warp4j/compare/master...HEAD [1.0.0]: https://git.phoenix.ipv64.de/public/warp4j/compare/stable...master -[origin warp4j]: https://github.com/guziks/warp4j \ No newline at end of file +[origin warp4j]: https://github.com/guziks/warp4j diff --git a/README.md b/README.md index ca2e93d..e4278c3 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,12 @@ 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](https://git.phoenix.ipv64.de/public/warp) -- works on Linux, macOS and Windows (with Windows Subsystem for Linux) -- supports cross "compilation" -- does not require neither JDK nor JRE installed +- 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 ## TL;DR @@ -17,19 +17,19 @@ Just put both `warp4j` and `warp-packer` somewhere in your PATH and run `warp4j ## Install -Curl one-liner installs latest versions of both `warp4j` and `warp-packer`: +Curl one-liner installs the 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)" ``` -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). ## Usage -``` +```sh $ ls my-app.jar @@ -53,62 +53,84 @@ my-app-windows-x64.zip See help: -``` -$ wapr4j --help - +```sh +$ warp4j --help Usage: warp4j [options] -Turn JAR (java archive) into self-contained executable +Turn JAR (java archive) into a self-contained executable Options: -j, --java-version - override JDK/JRE version - examples: "17", "17.0", "17.0.2", "17.0.2+9" + Override JDK/JRE version + Examples: "17", "17.0", "17.0.2", "17.0.2+9" (default: 17) -cp, --class-path - 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 + 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 + Ignored when -cp, --class-path is set -o, --output - override output directory; - this is relative to current PWD + Override output directory; + This is relative to current PWD (default: ./warped) -p, --prefix - if set, warp-packer will use the 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: + --list Show available java releases; + Takes into consideration other options: "--java-version", "--no-optimize", "--jvm-impl"; - the output may be used to specify concrete + 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 + --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 + --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 + --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 - passed to java like this: + Passed to java like this: "java -jar "; - use quotes when passing multiple options - example: '-Xms512m -Xmx1024m' - -s, --silent using javaw instead of java for windows - -h, --help show this message - + Use quotes when passing multiple options + Example: '-Xms512m -Xmx1024m' + -s, --silent Using javaw instead of java for windows + -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 Tested on the following operating systems: @@ -122,4 +144,4 @@ 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. +To override cache path, set `WARP4J_CACHE` environment variable. \ No newline at end of file diff --git a/warp4j b/warp4j index bb7551b..936ef3e 100755 --- a/warp4j +++ b/warp4j @@ -4,53 +4,52 @@ function print_help { echo echo 'Usage: warp4j [options] ' echo - echo 'Turn JAR (java archive) into self-contained executable' + echo 'Turn JAR (java archive) into a self-contained executable' echo echo 'Options:' echo ' -j, --java-version ' - echo ' override JDK/JRE version' - echo ' examples: "17", "17.0", "17.0.2", "17.0.2+9"' + echo ' Override JDK/JRE version' + echo ' Examples: "17", "17.0", "17.0.2", "17.0.2+9"' echo ' (default: 17)' echo ' -cp, --class-path ' - echo ' adds additional classpaths to the jdeps call' - echo ' --auto-class-path extract and get class-path values from jar file' - echo ' ignored when -cp, --class-path is set' - echo ' --spring-boot extract and get class-path values from' + echo ' Adds additional classpaths to the jdeps call' + echo ' --auto-class-path Extract and get class-path values from jar file' + echo ' Ignored when -cp, --class-path is set' + echo ' --spring-boot Extract and get class-path values from' 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 ' - echo ' override output directory;' - echo ' this is relative to current PWD' + echo ' Override output directory;' + echo ' This is relative to current PWD' echo ' (default: ./warped)' echo ' -p, --prefix ' - echo ' if set, warp-packer will use the prefix' - echo ' as target folder in which the ' + echo ' If set, warp-packer will use the prefix' + echo ' as target folder in which the' echo ' application should be extracted' - echo ' --list show available java releases;' - echo ' takes into consideration other options:' + echo ' --list Show available java releases;' + echo ' Takes into consideration other options:' 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 ' --no-optimize use JRE instead of optimized JDK;' - echo ' by default jdeps and jlink are used to create' + echo ' --no-optimize Use JRE instead of optimized JDK;' + echo ' By default jdeps and jlink are used to create' echo ' optimized JDK for the particular jar;' echo ' JRE is always used for java 8' - echo ' --pull check if more recent JDK/JRE distro is available;' - echo ' by default latest cached version that matches' + echo ' --pull Check if more recent JDK/JRE distro is available;' + echo ' By default latest cached version that matches' echo ' "--java-version" is used' - echo ' to get the classpath for jdeps call' - echo ' --linux create binary for Linux' - echo ' --macos create binary for macOS' - echo ' --windows create binary for Windows' - echo ' if no targets are specified then binaries for' + echo ' --linux Create binary for Linux' + echo ' --macos Create binary for macOS' + echo ' --windows Create binary for Windows' + echo ' If no targets are specified then binaries for' echo ' all targets are created' echo ' --jvm-options ' - echo ' passed to java like this:' + echo ' Passed to java like this:' echo ' "java -jar ";' - echo ' use quotes when passing multiple options' - echo " example: '-Xms512m -Xmx1024m'" - echo ' -s, --silent using javaw instead of java for windows' - echo ' -h, --help show this message' + echo ' Use quotes when passing multiple options' + echo " Example: '-Xms512m -Xmx1024m'" + echo ' -s, --silent Using javaw instead of java for windows' + echo ' -h, --help Show this message' exit } From 08867fbc1b2c8cfc665e7d277d225b0ea57b18c2 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 31 May 2024 15:19:30 +0200 Subject: [PATCH 4/6] Updating CHANGELOG.md --- CHANGELOG.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8029d46..1a1f634 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,18 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### 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. -## [1.0.0] - 2024-05-20 -### Added -- Install script improved to run with /bin/sh -- Dockerfile changed to use install.sh script (Works on x64 and aarch64 architecture) -- Dockerfile_x64 with old build script for tests - +## [v1.0.0] - 2024-05-20 ### Changed - Script warp4j improved to support running on aarch64 architecture +- Install script improved to run with /bin/sh +- Dockerfile changed to use install.sh script (Works on x64 and aarch64 architecture) + +### Added +- Dockerfile_x64 with old build script for tests ## [origin warp4j] - 2019-02-28 - See origin repository: https://github.com/guziks/warp4j [unreleased]: https://git.phoenix.ipv64.de/public/warp4j/compare/master...HEAD -[1.0.0]: https://git.phoenix.ipv64.de/public/warp4j/compare/stable...master +[v1.0.0]: https://git.phoenix.ipv64.de/public/warp4j/compare/stable...v1.0.0 [origin warp4j]: https://github.com/guziks/warp4j From 1e118f4db6cc81fb402ea05254e431a311b52c46 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 31 May 2024 20:02:10 +0200 Subject: [PATCH 5/6] Updating CHANGELOG.md for release --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a1f634..913b33e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. 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). -## [Unreleased] +## [v1.1.0] - 2024-05-31 ### 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. @@ -22,5 +22,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - See origin repository: https://github.com/guziks/warp4j [unreleased]: https://git.phoenix.ipv64.de/public/warp4j/compare/master...HEAD +[v1.1.0]: https://git.phoenix.ipv64.de/public/warp4j/compare/v1.0.0...v1.1.0 [v1.0.0]: https://git.phoenix.ipv64.de/public/warp4j/compare/stable...v1.0.0 -[origin warp4j]: https://github.com/guziks/warp4j +[origin warp4j]: https://github.com/guziks/warp4j \ No newline at end of file From 6f4819448f65eec3265b7dbebd0e97c15b485ed5 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 31 May 2024 20:10:14 +0200 Subject: [PATCH 6/6] Adding Unreleased again. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 913b33e..b9de507 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file. 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). +## [Unreleased] + ## [v1.1.0] - 2024-05-31 ### 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.