Installing OR-Tools for Java from Binary on Linux

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:

  • Ubuntu 20.10/20.04 LTS/18.04 LTS 64-bit (x86_64)
  • Alpine Edge 64-bit (x86_64)
  • Debian 10.2 (buster) 64-bit (x86_64)
  • Centos 8 64-bit (x86_64)

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 maven
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 maven

Debian 10

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

Ubuntu 20.10

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

Ubuntu 20.04 LTS

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

Ubuntu 18.04 LTS

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

Installing OR-Tools

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

Download and extract the binary distribution for your system:

FlatZinc binary distributions

FlatZinc is a solver input language understood by a wide range of solvers.
OR-Tools also provides binary distributions with FlatZinc support:

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_java

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