![](/img/trans.png)
[英]error while launching eclipse RCP application with latest plugins ( Eclipse 4.8 )
[英]Error in launching Java application on Eclipse
我刚刚在 Windows 10 上安装了 Eclipse(2020 版)和 IBM ILOG CPLEX(12.6.9 版),运行 ZD52387880E1EA22817A72D3759218 已经有这个代码。
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.
我遵循了这些步骤,但是当我启动执行时,我收到了这个错误:
Error: Unable to initialize main class Scheduler_1 Caused by: java.lang.NoClassDefFoundError: ilog/concert/IloNumExpr
其他信息:导航到Run > Run Configurations... > Java Application
并选择Arguments tab
Show Command Line
:
`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`
有没有人知道这可能是我遇到的错误的原因?
添加更多详细信息:这些是我遵循的步骤:
下载 Eclipse 2020-12 ".zip" 文件并保存在 "Download" 文件夹中,并下载 CPLEX 12.6.9 "exe" 文件
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"文件
打开Eclipse,新建一个Eclipse Java项目,名为proj1
在proj1/src/
中添加了四个“.java”源文件(从我 PC 的另一个文件夹复制粘贴)
在 Eclipse GUI 上:
Project > Properties > Java Build Path > Libraries
Add External JARs
cplex.jar
。在 Eclipse GUI 上:
Run > Run Configurations... > Java Application
Main tab
, select 我的Main Class
(称为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
我运行 Java 应用程序,我收到错误:
Error: Unable to initialize main class Scheduler_1 Caused by: java.lang.NoClassDefFoundError: ilog/concert/IloNumExpr
此外,我的代码中甚至没有使用IloNumExpr
,而且,无论如何,它包含在cplex.jar
中(我自己检查过)。
其他细节:这是我项目的directory structure
(我可以从Package Explorer
中看到,它是 Eclipse Workspace
的一部分):
proj1
src
(default packages)
:它包含四个“.java”文件(我从我电脑的另一个文件夹中复制粘贴)JRE System Library
Referenced Library
:它包含cplex.jar
(我添加的外部库)最后,我似乎解决了我的问题。 我在这里发布对遇到相同错误的任何人有用的方法。
我导航到Project -> Properties -> Build Path
,然后单击Dependencies Tab
并从Modulepath Entries
中删除cplex.jar
并将其添加到Classpath Entries
。
现在,之前的错误解决了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.