When using the Gurobi Java API., you may see a java.lang.NoClassDefFoundError exception such as:
java.lang.NoClassDefFoundError: Could not initialize class gurobi.GurobiJni
This error indicates that the Gurobi Java API (gurobi.jar) was not found within your Java classpath at the time of execution. This file is located in the lib subdirectory of the Gurobi installation.
To set the classpath for Java on Linux, you can use either:
- the CLASSPATH environment variable
- the command-line option -cp or -classpath for the Java Runtime Environment