0

I have a newbie problem with taking the Cplex library in Eclipse,

Error: Could not find or load main class Files\IBM\ILOG\CPLEX_Studio1210\cplex\bin\x64_win64 Caused by: java.lang.ClassNotFoundException: Files\IBM\ILOG\CPLEX_Studio1210\cplex\bin\x64_win64

I added cplex.jar from external libraries and also added the native path by editing it, CPLEX library path error in eclipse

under VMArguments I added, -Djava.library.path=C:\Program Files\IBM\ILOG\CPLEX_Studio1210\cplex\bin\x64_win64

where cplex12100.dll stands. I managed to work with it before but I couldn't find why it is not working right now.

Everything is 64bit.

Thanks in advance!

3 Answers3

1

Your error message references the following path:

Files\IBM\ILOG\CPLEX_Studio1210\cplex\bin\x64_win64

Notice that it does not start with "C:Program Files". My guess is that you need to put quotes around the path you are providing, like so:

-Djava.library.path="C:\Program Files\IBM\ILOG\CPLEX_Studio1210\cplex\bin\x64_win64"

This should allow Java to handle your path which includes a space character.

rkersh
  • 4,447
  • 2
  • 22
  • 31
1

thanks for the answer, Unfortunately, I forgot to add that I already tried that, but it gives another error when I try like that.

Error: Unable to initialize main class model(my package name).model(my class name) Caused by: java.lang.NoClassDefFoundError: ilog/concert/IloException

Here is part of my code, I cut half of it(after ...) since I guess it is unrelated to the question.

package model;
import ilog.concert.*;
import ilog.cplex.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.util.*;
import java.time.Instant;
import java.util.concurrent.TimeUnit;
public class model {




public static void main(String[] args) throws Exception {


     long startTime = Instant.now().toEpochMilli();

     int a = 45; //matrisin boyutu
     int b = 45; //matrisin 2. boyutu
     int maxdistance = 90; //mesela 90 dan küçük deðerler
     int depot = 0;
     double alfa = 0.9;
     double beta = 0.1;
     float[][] distance = new float[a][b]; // bunu scanner dan çektik

     int m = 3;
     int C = 1200;

     System.out.println();
     System.out.println("m : " + m + "      C : " + C );
     System.out.println();

     ArrayList<ArrayList> Nlist = new ArrayList<ArrayList>();

     Scanner reader = null;
     File burdurData = new File("burdur45.txt");

    ...


    try {

        long timeElapsed = endTime - startTime;

        System.out.println("Execution time in milliseconds: " + timeElapsed);
        System.out.println("Execution time in seconds: " + timeElapsed/1000);



        } // try'ýn parantezi

    catch (IloException exc) {
        System.out.println(exc);
        System.out.println("sýkýntý");
    }



   }

}
  • Rather than responding with an "answer", you should *edit* your question. You might even consider asking a new question; one issue was fixed, now you have a different one. With that said, it sounds like you need to fix the path to `cplex.jar`, which should be specified with the `-classpath` option. – rkersh Mar 04 '20 at 14:42
  • @baris I have your same issue (Caused by: `java.lang.NoClassDefFoundError: ilog/concert/IloException`)..did you solved it? – rainbow Feb 12 '21 at 14:37
0

surely you should edit your question. In fact, for getting error:

java.lang.NoClassDefFoundError: ilog/concert/IloException

I had this error before and I solved it just by importing cplex.jar in ClassPath section of my project Java Build Path not in ModulePath. Also set Native Library Location path to cplex's dlls folder too. Furthermore you can check your details in java configuration->show command line too.

DVenus
  • 1
  • 1