[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-05 UTC."],[[["\u003cp\u003eThis guide provides instructions for setting up and running OR-Tools in Java on various Linux distributions.\u003c/p\u003e\n"],["\u003cp\u003eUsers must have Java JDK 8.0 or higher and Maven 3.3 or higher installed as prerequisites.\u003c/p\u003e\n"],["\u003cp\u003eOR-Tools can be easily integrated into Maven projects by adding a dependency to the project's \u003ccode\u003epom.xml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eThe guide includes steps to download, build, and run a simple OR-Tools example application.\u003c/p\u003e\n"],["\u003cp\u003eUpon successful completion, users can proceed to further explore and utilize OR-Tools functionalities.\u003c/p\u003e\n"]]],["This guide details how to set up and run OR-Tools in Java. First, install Java JDK (version 8.0 or higher) using the appropriate commands for your OS (Alpine, Centos, Debian, Fedora, OpenSUSE, or Ubuntu). Next, install Maven (version 3.3 or higher) with similar commands. To include OR-Tools, add the provided dependency to your `pom.xml` file. Download or clone the `java_or-tools` repository, then navigate to its directory. Finally, build and run the example using `mvn compile -B` and `mvn exec:java`.\n"],null,["# Using OR-Tools Maven for Java\n\nIntroduction\n------------\n\nThis guide gets you started with OR-Tools in Java with a simple working\nexample.\n\nAlthough these instructions might also work on other Linux variants, we\nhave only tested them on machines meeting the following requirements:\n\n\n- Alpine Edge 64-bit (x86_64)\n- Centos 7 LTS 64-bit (x86_64)\n- Debian SID 64-bit (x86_64)\n- Debian 11 (bullseye) 64-bit (x86_64)\n- Fedora 38 64-bit (x86_64)\n- Fedora 37 64-bit (x86_64)\n- OpenSuse Leap 64-bit (x86_64)\n- Ubuntu 24.10 64-bit (x86_64)\n- Ubuntu 22.04 LTS 64-bit (x86_64)\n- Ubuntu 20.04 LTS 64-bit (x86_64)\n\n\u003cbr /\u003e\n\nPrerequisites\n-------------\n\nThe following sections describe the prerequisites for installing OR-Tools.\n\n### Java JDK \\\u003e= 8.0\n\nTo install the Java JDK version 8.0 or higher, open a terminal window and enter: \n\n### Alpine\n\n sudo apk add openjdk8\n export JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk\n\n### Centos\n\n sudo yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel\n\n### Debian\n\n sudo apt install -y default-jdk\n export JAVA_HOME=/usr/lib/jvm/default-java\n\n### Fedora\n\n sudo dnf install -y java-openjdk java-openjdk-devel\n\n### Fedora\n\n sudo dnf install -y java-openjdk java-openjdk-devel\n\n### OpenSUSE\n\n sudo zypper install -y java-1_8_0-openjdk java-1_8_0-openjdk-devel\n\n### Ubuntu\n\n sudo apt install -y default-jdk\n\n### Ubuntu\n\n sudo apt install -y default-jdk\n\n### Ubuntu\n\n sudo apt install -y default-jdk\n\n### Maven \\\u003e= 3.3\n\nTo install Maven version 3.3 or higher, open a terminal window and enter: \n\n### Alpine\n\n sudo apk add maven\n\n### Centos\n\n sudo yum install -y maven\n\n### Debian\n\n sudo apt install -y maven\n\n### Fedora\n\n sudo dnf install -y maven\n\n### Fedora\n\n sudo dnf install -y maven\n\n### OpenSUSE\n\n sudo zypper install -y maven\n\n### Ubuntu\n\n sudo apt install -y maven\n\n### Ubuntu\n\n sudo apt install -y maven\n\n### Ubuntu\n\n sudo apt install -y maven\n\nYou can test Maven is correctly installed and can find java using the following command: \n\n mvn -v\n\n\u003cbr /\u003e\n\nInstalling with Maven\n---------------------\n\nTo include OR-Tools in your Maven application, add a dependency on its artifacts\nto your project's pom.xml file. For example, \n\n \u003c!-- https://mvnrepository.com/artifact/com.google.ortools/ortools-java --\u003e\n \u003cdependency\u003e\n \u003cgroupId\u003ecom.google.ortools\u003c/groupId\u003e\n \u003cartifactId\u003eortools-java\u003c/artifactId\u003e\n \u003cversion\u003e9.12.4544\u003c/version\u003e\n \u003c/dependency\u003e\n\nGet the Java example code\n-------------------------\n\nThe example code is located in the\n[java_or-tools](https://github.com/or-tools/java_or-tools) repository.\n\n1. [Download the repository as a zip file](https://github.com/or-tools/java_or-tools/archive/v9.12.zip)\n and extract it, or clone the repository:\n\n git clone -b v9.12 --depth 1 https://github.com/or-tools/java_or-tools\n\n2. Change to the examples directory:\n\n cd java_or-tools\n\nBuild the example\n-----------------\n\nFrom the `java_or-tools` directory:\n\nBuild the project using:\n\n\n mvn compile -B\n\n\u003cbr /\u003e\n\nRun the example\n---------------\n\nFrom the `java_or-tools` directory:\n\nRun the binary using:\n\n\n mvn exec:java\n\n\u003cbr /\u003e\n\nCongratulations! You've just run an application with OR-Tools, you are ready to\n[get started with OR-Tools](../../introduction/java)."]]