I've run into a linking error that has me stumped. I'm coding in Java, on Linux, using the NetBeans IDE. I have two projects (A and B), with A creating a library jar file and B creating a user program. Both include the CPLEX 12.6 jar file among their respective compilation libraries, and B includes A's jar file. Both find the path to the CPLEX binary file on the LD_LIBRARY_PATH environment variable. A contains a MIP model, and B contains its own MIP model as well as calling methods in A.
Everything worked fine until I added an aborter to the MIP in A. In one of A's classes, I include the lines
private final Aborter aborter;
at the top of the class and
aborter = new Aborter(); // * problem occurs here
in the class constructor. (Attaching the aborter to an instance of IloCplex() comes later, and as it turns out never happens because the code dies before then.)
Project A contains its own demo program. After cleaning and building A, I can run A's demo (which among other things attaches the aborter to an instance of IloCplex) and everything runs fine. When I run B, however, I get a run time exception at the point where A's constructor (called from B) hits the indicated line. The exception message is "java.lang.UnsatisfiedLinkError: ilog.cplex.Cplex.newNativeInt()J".
I found a somewhat ugly work-around by moving the code that declares and attaches the aborter from A to B, but I'd like to be able to move it back someday. (Other programs besides B may want the option to abort a long solve in A.) Frankly, I'm baffled as to how I can be getting an unsatisfied link error when B calls A when the same link apparently is made when I run the main method in A. Anyone have any clues to share?
Thanks,
Paul
#CPLEXOptimizers#DecisionOptimization