ok tutto chiaro..ho aggiunto la libreria .jar al progetto attraverso Properties, pensavo fosse tutto ok ed invece quando ho eseguito un esempio che ho trovato nella spiegazione:
codice:
import lpsolve.*;
public class Demo {
public static void main(String[] args) {
try { // Create a problem with 4 variables and 0 constraints
LpSolve solver = LpSolve.makeLp(0, 4); // add constraints
solver.strAddConstraint("3 2 2 1", LpSolve.LE, 4);
solver.strAddConstraint("0 4 3 1", LpSolve.GE, 3); // set objective function
solver.strSetObjFn("2 3 -2 3"); // solve the problem
solver.solve(); // print solution
System.out.println("Value of objective function: " + solver.getObjective());
double[] var = solver.getPtrVariables();
for (int i = 0; i < var.length; i++) {
System.out.println("Value of var[" + i + "] = " + var[i]);
} // delete the problem and free memory
solver.deleteLp();
} catch (LpSolveException e) {
e.printStackTrace();
}
}
}
restituisce l'errore:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lpsolve55j in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java :1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at lpsolve.LpSolve.<clinit>(LpSolve.java:274)
at Demo.execute(Demo.java:38)
at Demo.main(Demo.java:281)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
non riesco a capire perchè...