Skip to content
Junming Chen edited this page Nov 13, 2025 · 6 revisions

Prerequisites

Build Instructions

Initial Setup

  1. Clone the PDFsam repository
  2. Checkout the tag/branch you want to build (e.g., git checkout v5.4.1)

macOS

Note: Homebrew's OpenJDK 21 does not work. Use Liberica OpenJDK 21 instead.

  1. Download and install Liberica JDK 21
  2. Set JAVA_HOME and build:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/liberica-jdk-21.jdk/Contents/Home

# Build with tests
mvn clean package -Drelease

# Build without tests (faster)
mvn clean package -Drelease -DskipTests

Note: You may see a signing certificate error - this can be safely ignored for local testing.

Linux

Native Build

If you have JDK 21 and gettext installed:

# Build with tests
mvn clean package -Drelease

# Build without tests (faster)
mvn clean package -Drelease -DskipTests

Docker Build (Linux only)

Build without installing dependencies on your system using Docker:

docker run --rm -v "$PWD":/app -w /app mcr.microsoft.com/openjdk/jdk:21-ubuntu \
  bash -c "apt-get update && apt-get install -y maven gettext && mvn clean package -Drelease -DskipTests"

Important Notes:

  • Use Microsoft's OpenJDK image (mcr.microsoft.com/openjdk/jdk:21-ubuntu) as it includes the full JDK with jmods directory required for jlink
  • The Liberica liberica-openjdk-debian:21 image lacks jmods and will fail during the jlink step
  • macOS users: The Docker build creates Linux-specific binaries (bundled runtime + JavaFX native libraries) that cannot run on macOS. You must use the native macOS build (see macOS section above) to create runnable macOS applications

Run

After building, find the assembled application in pdfsam-basic/target/assembled/:

pdfsam-basic/target/assembled/bin/pdfsam.sh

Clone this wiki locally