You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add Windows packaging support with .msi installer
* Update and clarify information in README.
* Refactored build.xml then split javadoc target in two: usage api, internal
* Update src/Main.java comment about hidden constructor and add author and version tags
Copy file name to clipboardExpand all lines: README.md
+31-15Lines changed: 31 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1
# NativeJavaApp
2
2
Scaffold for creating double-clickable apps using Java
3
3
4
-
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).
4
+
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).
5
5
6
6
## Common Requirements (All Systems)
7
7
Before running the build, ensure the following are installed and configured:
8
-
- JDK 21 or 25: Must be installed. jpackage was introduced in JDK 14, but JDK 21+ is recommended for modern macOS/Linux support.
8
+
- JDK 21 or 25: Must be installed. Although jpackage was introduced in JDK 14, JDK 21+ is recommended for modern macOS/Linux/Windows support.
9
9
- Apache Ant: Installed and available in your PATH.
10
-
- JAVA_HOME: This environment variable must point to your JDK installation directory.
11
-
- Check via: ant -version and java -version
10
+
-`JAVA_HOME`: This environment variable must point to your JDK installation directory.
11
+
- Check via: `ant -version` and `java -version`
12
12
## macOS Setup
13
13
To build the .dmg installer, your Mac needs the following:
14
14
- Xcode Command Line Tools: Required for various build utilities.
15
-
- Install via: xcode-select --install
15
+
- Install via: `xcode-select --install`
16
16
- Icon Asset: A file named icon.icns must be in the project root.
17
17
- 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.
18
18
## Ubuntu / Debian Setup
@@ -27,24 +27,35 @@ sudo apt install ant fakeroot dpkg-dev
27
27
- fakeroot: Allows the package to be built with correct file permissions without requiring root access.
28
28
- dpkg-dev: Provides the core utilities to create Debian packages.
29
29
- Icon Asset: A file named icon.png (512x512 recommended) must be in the project root.
30
+
## Windows Setup
31
+
To build the .msi installer on Windows, ensure the following:
32
+
- JDK 21 or 25: Must be installed with JAVA_HOME configured.
33
+
- Apache Ant: Installed and available in your PATH.
34
+
- WiX Toolset: Required by jpackage to create MSI installers.
35
+
- Download and install from: https://wixtoolset.org/releases/
36
+
- Version 3.11 or higher is recommended.
37
+
- After installation, verify WiX is in your PATH by running: `candle -?`
38
+
- Icon Asset: A file named icon.ico must be in the project root.
39
+
- 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.
30
40
## Project Directory Structure
31
41
Ensure your project looks like this for the build.xml to find all resources:
32
42
33
43
```Plaintext
34
-
MyAntApp/
44
+
MyAppName/
35
45
├── src/
36
46
│ └── Main.java # Your source code
37
47
├── icon.icns # Required for macOS DMG
38
48
├── icon.png # Required for Ubuntu DEB
49
+
├── icon.ico # Required for Windows MSI
39
50
└── build.xml # The Ant build script
40
51
```
41
52
## Usage Commands
42
-
Open your terminal in the project root and use the following targets:
53
+
Open a terminal in the project root and use the following targets:
43
54
44
55
| Command | Description |
45
56
|-----|-----|
46
57
| ant | The default; runs the package target. |
47
-
| ant package | Automatically detects OS and builds .dmg (Mac) or .deb (Linux). |
58
+
| ant package | Automatically detects OS and builds .dmg (Mac), .deb (Linux), or .msi (Windows). |
48
59
| ant run | Compiles and launches the app immediately for testing. |
49
60
| ant clean | Deletes the build/ and dist/ folders to start fresh. |
50
61
| 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:
58
69
<td>Linux Icon Error: </td>
59
70
<td>If the Linux build fails, ensure icon.png is not just a renamed .icns or .jpg. It must be a valid PNG file.</td>
60
71
</tr>
72
+
<tr>
73
+
<td>Windows "candle.exe not found": </td>
74
+
<td>Install WiX Toolset 3.11+ and ensure it's in your PATH. jpackage uses WiX to create MSI installers on Windows.</td>
75
+
</tr>
61
76
<tr>
62
77
<td>Permissions: </td>
63
78
<td>If the generated .app or .deb won't execute, ensure you have the necessary write permissions in the dist/ directory.</td>
@@ -69,15 +84,15 @@ This project uses GitHub Actions to automatically build and distribute native in
69
84
70
85
### The Build Phase (Continuous Integration)
71
86
Every time you push code to the main branch or open a Pull Request:
72
-
- GitHub starts a macOS runner and an Ubuntu runner.
73
-
-Both systems compile the code and create their respective installers (.dmgand .deb).
87
+
- GitHub starts a macOS runner, an Ubuntu runner, and a Windows runner.
88
+
-All systems compile the code and create their respective installers (.dmg, .deb, and .msi).
74
89
- The installers are saved as Artifacts in the GitHub Actions run summary for 90 days.
75
90
### The Release Phase (Continuous Deployment)
76
91
A formal GitHub Release is only triggered when you push a version tag.
77
-
This creates a permanent download page for your users.
92
+
This creates a permanent download page for users.
78
93
79
94
#### How to trigger a new release:
80
-
To release a new version (e.g., version 1.0.1), run the following commands in your terminal:
95
+
To release a new version (e.g., version 1.0.1), run the following commands in a terminal:
81
96
82
97
```Bash
83
98
# 1. Tag the current commit
@@ -92,8 +107,9 @@ git push origin v1.0.1
92
107
- Under Assets, you will find:
93
108
- MyAntApp-Installer.dmg (for macOS)
94
109
- MyAntApp-Linux.deb (for Ubuntu/Debian)
110
+
- MyAntApp-Windows.msi (for Windows)
95
111
96
-
### Pro-Tip: Changing the Version Number
97
-
When you're ready to bump the version, remember to update the version number in two places to keep everything in sync:
112
+
### Changing the Version Number
113
+
When ready to bump the version, remember to update the version number in **two** places to keep everything in sync:
98
114
- The Git Tag (the v1.0.1 above).
99
-
- The app.version property at the top of your build.xml. This ensures that when the user installs the app, the OS sees the correct version number in the "About" or "Get Info" screens.
115
+
- The **app.version** property at the top of `build.xml`. This ensures that when the user installs the app, the OS sees the correct version number in the "About" or "Get Info" screens.
0 commit comments