diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d7071bc..050840d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, ubuntu-latest] + os: [macos-latest, ubuntu-latest, windows-latest] steps: - name: Checkout Code @@ -61,6 +61,7 @@ jobs: files: | artifacts/*.dmg artifacts/*.deb + artifacts/*.msi body: "Automatic build of ${{ github.ref_name }}" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 249acd3..5eb3b76 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ # NativeJavaApp Scaffold for creating double-clickable apps using Java -This project uses Apache Ant and JDK 25 to compile, bundle, and package a Java application into native installers (.dmg for macOS and .deb for Ubuntu). +This project uses Apache Ant and JDK 25 to compile, bundle, and package a Java application into native installers (.dmg for macOS, .deb for Ubuntu, and .msi for Windows). ## Common Requirements (All Systems) Before running the build, ensure the following are installed and configured: -- JDK 21 or 25: Must be installed. jpackage was introduced in JDK 14, but JDK 21+ is recommended for modern macOS/Linux support. +- JDK 21 or 25: Must be installed. Although jpackage was introduced in JDK 14, JDK 21+ is recommended for modern macOS/Linux/Windows support. - Apache Ant: Installed and available in your PATH. -- JAVA_HOME: This environment variable must point to your JDK installation directory. - - Check via: ant -version and java -version +- `JAVA_HOME`: This environment variable must point to your JDK installation directory. + - Check via: `ant -version` and `java -version` ## macOS Setup To build the .dmg installer, your Mac needs the following: - Xcode Command Line Tools: Required for various build utilities. - - Install via: xcode-select --install + - Install via: `xcode-select --install` - Icon Asset: A file named icon.icns must be in the project root. - Note on Security: Since the app is not "Signed" with an Apple Developer Certificate, users may need to Right-Click > Open the app the first time to bypass the "Unidentified Developer" warning. ## Ubuntu / Debian Setup @@ -27,24 +27,35 @@ sudo apt install ant fakeroot dpkg-dev - fakeroot: Allows the package to be built with correct file permissions without requiring root access. - dpkg-dev: Provides the core utilities to create Debian packages. - Icon Asset: A file named icon.png (512x512 recommended) must be in the project root. +## Windows Setup +To build the .msi installer on Windows, ensure the following: +- JDK 21 or 25: Must be installed with JAVA_HOME configured. +- Apache Ant: Installed and available in your PATH. +- WiX Toolset: Required by jpackage to create MSI installers. + - Download and install from: https://wixtoolset.org/releases/ + - Version 3.11 or higher is recommended. + - After installation, verify WiX is in your PATH by running: `candle -?` +- Icon Asset: A file named icon.ico must be in the project root. +- Note on Security: Windows may show a SmartScreen warning for unsigned installers. Users will need to click "More info" > "Run anyway" to install the app. ## Project Directory Structure Ensure your project looks like this for the build.xml to find all resources: ```Plaintext -MyAntApp/ +MyAppName/ ├── src/ │ └── Main.java # Your source code ├── icon.icns # Required for macOS DMG ├── icon.png # Required for Ubuntu DEB +├── icon.ico # Required for Windows MSI └── build.xml # The Ant build script ``` ## Usage Commands -Open your terminal in the project root and use the following targets: +Open a terminal in the project root and use the following targets: | Command | Description | |-----|-----| | ant | The default; runs the package target. | -| ant package | Automatically detects OS and builds .dmg (Mac) or .deb (Linux). | +| ant package | Automatically detects OS and builds .dmg (Mac), .deb (Linux), or .msi (Windows). | | ant run | Compiles and launches the app immediately for testing. | | ant clean | Deletes the build/ and dist/ folders to start fresh. | | ant -p | Displays a help menu of all available targets. | @@ -58,6 +69,10 @@ Open your terminal in the project root and use the following targets: