I have a problem with adding cplex.jar to my java project. I installed the new Lion OX and I used to add the cplex.jar to my java projects easily when I had snow leopard, but now when I add the jar file and run the program I get the following error:
java.lang.UnsatisfiedLinkError: no cplex124 in java.library.path
java.library.path must point to the directory containing the CPLEX shared library
try invoking java with java -Djava.library.path=...
Exception in thread "main" java.lang.UnsatisfiedLinkError: ilog.cplex.Cplex.CPXopenCPLEX([I)J
at ilog.cplex.Cplex.CPXopenCPLEX(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
I even installed the cplex 12.4 and I use intelidea as an IDE for my java. Do you have any ideas?
This topic has been locked.
8 replies Latest Post - 2012-05-09T05:47:41Z by SystemAdmin
Pinned topic java and cplex
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-05-09T05:47:41Z at 2012-05-09T05:47:41Z by SystemAdmin
Re: java and cplex2012-03-07T08:04:02Z in response to SystemAdminDo the Java examples shipped with CPLEX work?
To test this do (replace /path/to/COS/installation, PORT and SYSLIB appropriately)
cd /path/to/COS/installation/cplex/examples/PORT/SYSLIB make execute_java
Does this work? Is this able to run the Java examples? Or do you get the same error message?
MarioWinter 120000KNXA2 Posts
Re: java and cplex2012-05-08T06:39:38Z in response to MarioWinterOn MacOS the extension for the shared library is '.jnilib' instead of '.so'. It should be in directory INSTALLROOT/cplex/bin/x86-64_darwin9_gcc4.0 (or INSTALLROOT/cplex/bin/x86_darwin9_gcc4.0 for 32bit systems).
MarioWinter 120000KNXA2 PostsACCEPTED ANSWER
Re: java and cplex2012-05-08T13:31:22Z in response to SystemAdminThanx, found it! The delivered make worked anyway, and the java examples run from the shell. Unfortunately, I dont get them compiled and executed with eclipse - the cplex124 lib not found error still exists. Maybe it's a configuration problem with jre and 32/64 bit or the eclipse internal compiler doesn't get the calls right?
Re: java and cplex2012-05-09T05:46:32Z in response to MarioWinterDid you set the java.library.path properly? In the run configuration you need a VM argument like
It may be that the virtual machine started by eclipse is different from the virtual machine you use on the command line. Maybe try the 32bit version of the CPLEX library and also the 64bit version of it.