Using OR-Tools Maven for Java


This guide gets you started with OR-Tools in Java with a simple working example.

Although these instructions might also work on other Windows variants, we have only tested them on machines meeting the following requirements:

Windows 10 64-bit (x86_64) with:

  • Microsoft Visual Studio Enterprise 2022
  • Microsoft Visual Studio Community 2022 Preview 2 or above


The following sections describe the prerequisites for installing OR-Tools.

Microsoft Visual C++ Redistributable

You must have the Microsoft Visual C++ Redistributable for Visual Studio 2022 (select the x64 version) installed on your computer, since OR-Tools library for Java is a wrapper for the C++ native library.

Java JDK

You must also have a Java JDK 64 bit, version 8.0 or later installed.

You can find more details here.


You must also have a Maven 64 bit installed.

You can find more details here.

Installing with Maven

To include OR-Tools in your Maven application, add a dependency on its artifacts to your project's pom.xml file. For example,

<!-- -->

Get the Java example code

The example code is located in the java_or-tools repository.

  1. Download the repository as a zip file and extract it, or clone the repository:

    git clone -b v9.10 --depth 1
  2. Change to the examples directory:

    cd java_or-tools

Build the example

From the java_or-tools directory:

Build the project using:

mvn compile -B

Run the example

From the java_or-tools directory:

Run the binary using:

mvn exec:java

Congratulations! You've just run an application with OR-Tools, you are ready to get started with OR-Tools.