I would like to load the local library /opt/gurobi902/linux64/lib/libGurobiJni90.so
within my Java IntelliJ Maven project on Ubuntu 19.10.
My first attempt was adding the environment variable LD_LIBRARY_PATH like this: export LD_LIBRARY_PATH="/opt/gurobi902/linux64/lib"
(I know I have completly overwritten it instead of appending to it, because it was not set at all previously.)
I thought it worked, because when I run the terminal command java -XshowSettings:propertiesjava -XshowSettings:properties
it returns this (among other things):
java.library.path = /opt/gurobi902/linux64/lib
/usr/java/packages/lib
/usr/lib/x86_64-linux-gnu/jni
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
/usr/lib/jni
/lib
/usr/lib
BUT when I want to load the library in my project with System.loadLibrary("GurobiJni90")
I receive this exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no GurobiJni90 in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]
As you can see, the directory I've added previously is not listed in java.library.path
of the exception statement.
Btw. this is my pom.xml
entry for the library:
<dependency>
<groupId>com.gurobi</groupId>
<artifactId>gurobi</artifactId>
<version>9.0.2</version>
<scope>system</scope>
<systemPath>/opt/gurobi902/linux64/lib/gurobi.jar</systemPath>
</dependency>