Java - CPLEX
For a seminar at university I need to program a model with java.
Since it is a maximization problem I also need to involve CPLEX methods. Therefore I successfully installed CPLEX on my Mac OS X Version 10.5.8.
To combine CPLEX and Eclipse (I also tried it with Netbeans) I connected my current project with the CPLEX library (Properties>Library>Add Library
).
Eclipse recognizes the library because the methods aren't underlinded. Additionally I committed the following argument to my run configurations:
-Djava.library.path=/Users/myname/Applications/IBM/ILOG/CPLEX_Studio126/cplex/bin/x86-64_osx
When I try to run an exemplary code (that is valid) I get the following error:
java.lang.UnsatisfiedLinkError: /Users/myname/Applications/IBM/ILOG/CPLEX_Studio126/cplex/bin/x86-64_osx/libcplex1260.jnilib: no suitable image found. Did find: /Users/myname/Applications/IBM/ILOG/CPLEX_Studio126/cplex/bin/x86-64_osx/libcplex1260.jnilib: unknown required load command 0x80000022Exception in thread "main" java.lang.UnsatisfiedLinkError: ilog.cplex.Cplex.CPXopenCPLEX([I)J
at ilog.cplex.Cplex.CPXopenCPLEX(Native Method)
at ilog.cplex.CplexI.init(CplexI.java:6594)
at ilog.cplex.CplexI.<init>(CplexI.java:629)
at ilog.cplex.IloCplex.<init>(IloCplex.java:11067)
at ilog.cplex.IloCplex.<init>(IloCplex.java:11082)
at Knapsack.buildModel(Knapsack.java:54)
at Knapsack.main(Knapsack.java:122)
java.library.path must point to the directory containing the CPLEX shared library
try invoking java with java -Djava.library.path=...
could you please be so kind to help me, i don't know any more what to do.
Thank you for an answer