Prerequisites
- Java Development Kit (JDK) 8 or later
- Java IDE (Eclipse, IntelliJ IDEA, or VS Code) - optional but recommended
Installation Options
Option 1: Pre-built Binaries (Recommended)
Download the latest Z3 release for your platform from the GitHub Releases page.Download Z3
Download the appropriate package:
- Windows:
z3-x.x.x-x64-win.zip - Linux:
z3-x.x.x-x64-glibc-x.x.zip - macOS:
z3-x.x.x-x64-osx-x.x.zip
Extract Archive
Extract to a location on your system (e.g.,
C:\z3 on Windows or /opt/z3 on Linux/macOS).Option 2: Build from Source
Build Z3 with Java bindings enabled:build directory:
com.microsoft.z3.jar- Native libraries (
libz3java.*andlibz3.*)
IDE Setup
Eclipse
Add Z3 JAR to Build Path
- Right-click project → Build Path → Configure Build Path
- Libraries tab → Add External JARs
- Select
com.microsoft.z3.jar - Click Apply and Close
IntelliJ IDEA
Add Z3 JAR to Project
- File → Project Structure (Ctrl+Alt+Shift+S)
- Modules → Dependencies
- Click + → JARs or directories
- Select
com.microsoft.z3.jar
Visual Studio Code
Command-Line Setup
Compiling
Running
Verify Installation
Create a test fileTestZ3.java:
TestZ3.java
Maven/Gradle Setup
Maven
Add Z3 as a system dependency inpom.xml:
pom.xml
com.microsoft.z3.jar in your project’s lib directory, and configure the native library path in your IDE or command line.
Gradle
Add tobuild.gradle:
build.gradle
Troubleshooting
ClassNotFoundException
- Verify
com.microsoft.z3.jaris in your classpath - Check IDE configuration (Project Properties → Java Build Path)
- Ensure proper classpath separator (
:on Unix,;on Windows)
UnsatisfiedLinkError
- Set
java.library.pathVM argument to Z3bindirectory - On Linux: Set
LD_LIBRARY_PATH - On macOS: Set
DYLD_LIBRARY_PATH - On Windows: Add Z3
binto PATH or use-Djava.library.path - Verify both
libz3java.*andlibz3.*files are present
ExceptionInInitializerError
- Ensure all Z3 files are from the same version
- Verify compatible Java version (JDK 8+)
- Check native library architecture matches JVM (32-bit vs 64-bit)
Platform-Specific Library Names
- Windows:
libz3.dllandlibz3java.dll - Linux:
libz3.soandlibz3java.so - macOS:
libz3.dylibandlibz3java.dylib
Next Steps
Getting Started
Learn the basics of the Z3 Java API
API Reference
Explore the complete Java API documentation
IDE Setup Guide
Detailed IDE configuration instructions
