Installing OR-Tools for Java from Binary on Linux

Stay organized with collections Save and categorize content based on your preferences.

 Introduction

This guide explains how to install OR-Tools for Java on Linux.

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

  • Alpine Edge 64-bit (x86_64)
  • Centos 7 64-bit (x86_64)
  • Centos Stream 8 64-bit (x86_64)
  • Debian 10 (buster) 64-bit (x86_64)
  • Debian 11 (bullseye) 64-bit (x86_64)
  • Fedora 33 64-bit (x86_64)
  • Fedora 34 64-bit (x86_64)
  • OpenSuse Leap 64-bit (x86_64)
  • Ubuntu 18.04 LTS 64-bit (x86_64)
  • Ubuntu 20.04 LTS 64-bit (x86_64)
  • Ubuntu 22.04 LTS 64-bit (x86_64)

Prerequisites

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

Java JDK >= 8.0

To install the Java JDK version 8.0 or higher, open a terminal window and enter:

Alpine Edge

sudo apk add openjdk8
export JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk

Centos 8

sudo dnf install java-1.8.0-openjdk java-1.8.0-openjdk-devel

Debian 10

sudo apt install default-jdk
export JAVA_HOME=/usr/lib/jvm/default-java

Ubuntu 22.04 LTS

sudo apt install default-jdk
export JAVA_HOME=/usr/lib/jvm/default-java

Ubuntu 20.04 LTS

sudo apt install default-jdk
export JAVA_HOME=/usr/lib/jvm/default-java

Ubuntu 18.04 LTS

sudo apt install default-jdk
export JAVA_HOME=/usr/lib/jvm/default-java

Maven >= 3.3

To install Maven version 3.3 or higher, open a terminal window and enter:

Alpine Edge

sudo apk add maven

Centos 8

sudo dnf install maven

Debian 10

sudo apt install maven

Ubuntu 22.04 LTS

sudo apt install maven

Ubuntu 20.04 LTS

sudo apt install maven

Ubuntu 18.04 LTS

sudo apt install maven

You can test Maven is correctly installed and can find java using the following command:

mvn -v

Installing OR-Tools

Take the following steps to install the OR-Tools library for Java:

Download and extract the binary distribution for your system:

Validate your installation

To test your Java installations, open a terminal window and navigate to the directory where you unpacked the binary distribution. Then enter the following command:

make test
This runs a selection of examples for OR-Tools. If all the examples run successfully, you are ready to get started with OR-Tools.