I just installed Eclipse (2020 version) and IBM ILOG CPLEX (12.6.9 version), on Windows 10, to run a Java code that I already have.
The code uses Java API of CPLEX, so I followed these few instructions (on CPLEX Official Page) - they explains to set a jar
and a dll
filepaths - to set up Eclipse for using Java API of CPLEX.
I followed those steps, but when I launch the execution I get this error:
Error: Unable to initialize main class Scheduler_1 Caused by: java.lang.NoClassDefFoundError: ilog/concert/IloNumExpr
Additional information: After navigating to Run > Run Configurations... > Java Application
, and selecting Arguments tab
, if I click on Show Command Line
, a dialog, which shows this output lines, appears (I don't know if it's correct):
`C:\Users\MY_USERNAME\Downloads\eclipse-java-2020-12-R-win32-x86_64\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre\bin\javaw.exe`
`-Djava.library.path=CPLEX_Studio_Community129/cplex/bin/x64_win64`
`-Dfile.encoding=Cp1252`
`-p "C:\Program Files\IBM\ILOG\CPLEX_Studio_Community129\cplex\lib\cplex.jar"`
`-classpath "C:\Users\MY_USERNAME\eclipse-workspace\proj1\bin"`
`-XX:+ShowCodeDetailsInExceptionMessages Scheduler_1`
Is there anyone who know which could be the cause of the error which I encounter?
To add more details: these are the steps I followed:
Download of Eclipse 2020-12 ".zip" file and saved in "Download" folder, and download of CPLEX 12.6.9 "exe" file
Extract Eclipse 2020-12 "zip" into a folder (with the same name of the "zip") inside "Download", then I install both Eclipse and CPLEX (on Windows 10), by double-clicking on their respective "exe" files
Open Eclipse, and created a new Eclipse Java Project, called proj1
Added four ".java" source files (copy-pasted from another folder of my PC) inside proj1/src/
On Eclipse GUI:
Project > Properties > Java Build Path > Libraries
Add External JARs
cplex.jar
.On Eclipse GUI:
Run > Run Configurations... > Java Application
Main tab
, and select my Main Class
(called Scheduler_1
)Arguments tab
, I select VM arguments
, and add the path to the CPLEX library, so in my case: -Djava.library.path=CPLEX_Studio_Community129/cplex/bin/x64_win64
, which is the path to cplex1290.dll
I run the Java application, and I get the error:
Error: Unable to initialize main class Scheduler_1 Caused by: java.lang.NoClassDefFoundError: ilog/concert/IloNumExpr
Besides, IloNumExpr
is not even used in my code, and, anyway, it is contained in cplex.jar
(I checked by myself).
Other details: this is the directory structure
of my project (which I could see from Package Explorer
, which is part of the Eclipse Workspace
):
proj1
src
(default packages)
: it contains four ".java" files (which I copy-pasted from another folder of my PC) JRE System Library
Referenced Library
: it contains cplex.jar
(external library added by me) Finally it seems I solved my issue. I post here what works for me for anyone who will encounter the same error.
I navigated to Project -> Properties -> Build Path
, then I clicked on Dependencies Tab
and I removed cplex.jar
from Modulepath Entries
and I added it to Classpath Entries
.
Now, the previous error is solved.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.