These instructions work only when you are not using a module file in your Java project.
On Windows
The Windows instructions were tested with JDK 21 and Eclipse 2024-12 on Feb 21, 2025.
- First, add the file gurobi.jar to the project:
- Select Project > Properties > Java Build Path > Libraries.
- Click "Add External Jars..." to add gurobi.jar. The file, gurobi.jar is in the lib subdirectory of the Gurobi installation.
- Next, add the native libraries to the path for the Run Configuration:
- Select Project > Properties Run/Debug Settings
- Select the Launch configuration or create a new one
- Click Edit ...
- Select the Environment tab.
- Set the system environment variable PATH to the absolute location of the
bin
subdirectory of the Gurobi installation.
On Linux
- First, add the file gurobi.jar to the project:
- select Project > Properties, select Java Build Path, and select Libraries.
- Add gurobi.jar as an External JAR; the file gurobi.jar is in the lib subdirectory of the Gurobi installation.
- Next, add the native libraries to the path for the Run Configuration
- Select the Run Configuration and select the Environment tab.
- Set the system environment variable LD_LIBRARY_PATH to the absolute location of the lib subdirectory of the Gurobi installation.
On MacOS
- No special configuration is necessary with the default installation of Gurobi Optimizer.