JAR Build for SmallTextPad
This guide covers building the standalone JAR file for SmallTextPad, a lightweight Java text editor with encryption and multi-language support.
Files
build-jar.sh- Script to compile sources and build the standalone JAR fileREADME-jar.md- This documentation file
Prerequisites
System Requirements
- Java 21+ JDK installed
- Standard Unix tools (bash, find)
Installing Build Dependencies
Fedora/RHEL/CentOS:
sudo dnf install java-21-openjdk-devel
Ubuntu/Debian:
sudo apt install openjdk-21-jdk
openSUSE:
sudo zypper install java-21-openjdk-devel
macOS:
brew install openjdk@21
Building the JAR File
The build script can be run from anywhere in the project:
From Project Root:
./packaging/build-jar.sh
From Packaging Directory:
cd packaging
./build-jar.sh
The script will:
- Navigate to the project root automatically
- Delete any existing compiled class files
- Generate a list of all Java source files
- Compile all Java sources to the
bin/directory - Copy resource bundles (
.propertiesfiles) to the correct package structure - Copy image resources to the JAR root for classpath access
- Copy dictionary files for spell-checking
- Create the JAR file with proper manifest
- Test launch the application
Build Output
After successful build:
- JAR file:
classes/artifacts/SmallTextPad.jar - Compiled classes:
bin/directory - Source list:
sources.txt(generated during build)
Running the JAR
Direct Execution:
java -jar classes/artifacts/SmallTextPad.jar
With File Argument:
java -jar classes/artifacts/SmallTextPad.jar /path/to/file.txt
Using Desktop Environment:
On systems with desktop integration, you can double-click the JAR file if .jar files are associated with Java.
JAR Contents
The JAR file includes:
- Compiled classes: All Java classes in proper package structure
- Resource bundles: Language files (English, Dutch, Polish, Portuguese)
wagemaker/co/uk/lang/LabelsBundle_*.properties
- Images: Application icons and toolbar images at JAR root
about.png,copy.png,cut.png,paste.png, etc.
- Dictionaries: Spell-check dictionaries
dic/Dictionary_en.txtdic/Dictionary_nl.txt
- Manifest: Proper Main-Class definition for executable JAR
Distribution
The generated JAR is a fully self-contained executable that can be:
- Copied to any system with Java 21+ installed
- Distributed via download links
- Included in other packaging formats (RPM, DEB, Snap, etc.)
- Run without installation
Troubleshooting
Build Fails - javac not found:
Ensure Java JDK is installed and javac is in your PATH:
which javac
javac -version
Application Doesn’t Launch:
Verify Java runtime is installed:
java -version
Missing Resources Error:
If you see MissingResourceException or NullPointerException for resources:
- Clean and rebuild:
rm -rf bin/ classes/artifacts/ ./packaging/build-jar.sh - Verify JAR contents:
jar tf classes/artifacts/SmallTextPad.jar | grep -E "(\.properties$|\.png$)"
Permission Denied:
Make the script executable:
chmod +x packaging/build-jar.sh
Development Workflow
For rapid development and testing:
- Edit source files in
src/directory - Run build script to compile and test:
./packaging/build-jar.sh - Application launches automatically for testing
- Close application and repeat as needed
The script automatically cleans previous builds, so you always get a fresh compile.
Notes
- The build script uses
set -euo pipefailto exit immediately on any error - Deprecation warnings during compilation are enabled with
-Xlint:deprecation - The script supports being run from any directory - it automatically finds the project root
- The JAR manifest specifies
wagemaker.co.uk.main.Launcheras the Main-Class
See Also
- RPM Build Guide - Building RPM packages for Fedora/RHEL/openSUSE
- Snap Build Guide - Building Snap packages for universal Linux distribution
- Windows Build Guide - Building Windows installers and portable packages
- Back to Home - Main documentation and downloads