Gurobi UnsatisfiedLinkError

2019-08-05 18:49发布

问题:

I am trying to install Gurobi under Academic Licence on Ubuntu 14.04. I have read the following post about the UnsatisfiedLinkError: stackoverflow.com/questions/.... But that didnt help me. I have extracted the zip in my opt folder. I have placed the licence file in /opt/gurobi600/linux64/lib/gurobi.lic.

I am trying to run the Callback.java example in Eclipse.

I have as Java VM argument: -Djava.library.path=/opt/gurobi600/linux64/lib/. I have as program argument: /opt/gurobi600/linux64/examples/data/qafiro.lp. The environment variable LD_LIBRARY_PATH is set on /opt/gurobi600/linux64/lib/gurobi.lic

And I get the following stacktrace:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/gurobi600/linux64/lib/libGurobiJni60.so: libgurobi60.so: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1880)
    at java.lang.Runtime.loadLibrary0(Runtime.java:849)
    at java.lang.System.loadLibrary(System.java:1088)
    at gurobi.GurobiJni.<clinit>(GurobiJni.java:197)
    at gurobi.GRBEnv.<init>(GRBEnv.java:16)
    at gurobi.GRBEnv.<init>(GRBEnv.java:11)
    at main.Callback.main(Callback.java:135)

Any ideas?

回答1:

It's all working properly now. I have removed the VM arguments in the run configurations menu, so that's all empty in Eclipse. I have changed the environment variables in Eclipse, they are now set to:

GUROBI_HOME      = /opt/gurobi600/linux64/
GRB_LICENSE_FILE = /opt/gurobi600/linux64/gurobi.lic
LD_LIBRARY_PATH  = /opt/gurobi600/linux64/lib/
PATH             = /opt/gurobi600/linux64/bin/