Exception in thread "main" java.lang.UnsatisfiedLinkError: no GurobiJni56 in java.library.path

1,418 views
Skip to first unread message

Henrik André Olsen

unread,
Nov 4, 2014, 8:28:52 AM11/4/14
to gur...@googlegroups.com
Greetings,

After playing around and making myself familiar with Gurobi in Java the last days, I've encountered the following exception when trying to run the Mip1 example:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no GurobiJni56 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1764)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1044)
    at gurobi.GurobiJni.<clinit>(GurobiJni.java:193)
    at gurobi.GRBEnv.<init>(GRBEnv.java:16)
    at Mip1.main(Mip1.java:12)

I have been running several models and example files just fine, and I have no idea what may have happened that is causing the link error. I am using Eclipse on a Macbook Pro, and I have not found any advices in the Gurobi FAQ section or by googling around elsewhere that has helped me so far.

Any suggestions for what is causing the error and how I can solve it? Thank you in advance!


Henrik

Renan Garcia

unread,
Nov 5, 2014, 6:19:51 PM11/5/14
to gur...@googlegroups.com
Henrik,

Eclipse is unable to find the Gurobi native library, 'libGurobiJni56.jnilib', which is installed in '/Library/gurobi563/mac64/lib/' by default for mac. First, verify that this file exists on your computer. Next, make sure you've added the file 'gurobi.jar' to the project (i.e., select Project > Properties > Java Build Path > Libraries and add '/Library/gurobi563/mac64/lib/gurobi.jar' as an External JAR). Finally, add '/Library/gurobi563/mac64/lib/' to the path for the Run Configuration (i.e., select the Run Configuration, select the Environment tab, and set the environment variable PATH to '/Library/gurobi563/mac64/lib/').

Renan

--

---
You received this message because you are subscribed to the Google Groups "Gurobi Optimization" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gurobi+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Henrik André Olsen

unread,
Nov 6, 2014, 6:39:51 AM11/6/14
to gur...@googlegroups.com
Renan, thank you for your reply!

I have verified that 'libGurobiJni56.jnilib' exists on the default location, and had already added 'gurobi.jar' to my project. I was hoping that your final suggestion, adding '/Library/gurobi563/mac64/lib' to the path would solve the problem, unfortunately it didn't. I have attached screenshots to show my setup. Please let me know if you spot any mistakes in this setup or may have other suggestions for solving the problem.


Henrik
Skjermbilde 2014-11-06 kl. 12.31.41.png
Skjermbilde 2014-11-06 kl. 12.29.44.png
Skjermbilde 2014-11-06 kl. 12.27.57.png

Renan Garcia

unread,
Nov 6, 2014, 4:14:06 PM11/6/14
to gur...@googlegroups.com
Henrik,

I'm trying to reproduce the error, but unable to do so. It appears as though you are using Yosemite. Your Java SE 6 JRE is pretty old (i.e., Java 7 was released in 2011). Which version of Eclipse is this?

Renan

<Skjermbilde 2014-11-06 kl. 12.31.41.png><Skjermbilde 2014-11-06 kl. 12.29.44.png><Skjermbilde 2014-11-06 kl. 12.27.57.png>

Henrik André Olsen

unread,
Nov 7, 2014, 8:10:02 AM11/7/14
to gur...@googlegroups.com
I am using the following version of Eclipse:

Eclipse IDE for Java Developers
Version: Luna Service Release 1 (4.4.1)

Do you think my problems may have something to do with my old Java SE 6 JRE?

Thank you for looking into the problem,


Henrik

Renan Garcia

unread,
Nov 7, 2014, 9:31:39 AM11/7/14
to gur...@googlegroups.com
I'm also using:

- Eclipse IDE for Java Developers, Luna Service Release 1 (4.4.1)
- Yosemite
- Gurobi 5.6.3

but unable to reproduce the error. The only difference I'm noticing is that I'm using JavaSE-1.8. You could try upgrading.

Also, I see multiple configurations in your screenshot, so make sure you are launching the same Run Configuration for which you've set the PATH variable.

Henrik André Olsen

unread,
Nov 10, 2014, 3:09:09 PM11/10/14
to gur...@googlegroups.com
Renan

Thank you for all your help and suggestions.

I consulted the IT helpdesk at my university this morning. Eventually, copying the gurobi jnilib from the lib folder to the bin folder turned out to solve the problem.


Henrik
Reply all
Reply to author
Forward
0 new messages