gpt4 book ai didi

java - 在 Eclipse 中使用 JaCoP 时出现 NoClassDefFoundError

转载 作者:行者123 更新时间:2023-12-02 08:34:38 27 4
gpt4 key购买 nike

我正在尝试在 Eclipse 项目中使用 JaCoP。我已经导入了库并且它出现在构建路径中,应用程序可以正常编译,但是当它到达需要库的位置时,我收到以下错误:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/jdom/Content
at layout.MainLayoutManager.<init>(MainLayoutManager.java:14)
at gui.Instance.<init>(Instance.java:48)
at handler.Main.createNewInstance(Main.java:59)
at handler.Main$2.actionPerformed(Main.java:111)

导致错误的代码是

package layout;

import graph.Cell;
import graph.Vertex;
import interfaces.LayoutManager;

import java.util.ArrayList;

import JaCoP.core.Store;

public class MainLayoutManager implements LayoutManager {
ArrayList<CPVertex> vertexList = new ArrayList<CPVertex>();
Store store = new Store();

public MainLayoutManager() {

}

public void sortGraph(Cell[] cells) {
for (int i=0; i<cells.length; i++) {
if (cells[i].getType() == Cell.VERTEX) {
vertexList.add(new CPVertex((Vertex) cells[i]));
}
}
}

}

具体来说,该行

Store store = new Store();

我非常感谢任何解决此错误的帮助。

最佳答案

java.lang.NoClassDefFoundError: org/jdom/Content

这仅仅意味着运行时类路径中缺少特定的类(虽然它在编译时类路径中可用,但这就是与 ClassNotFoundException 的区别)。

逻辑上的下一步是在运行时类路径中包含特定的类(或更实际上,包含特定类的 JAR 文件)。那么这个错误就会消失。

检查编译时类路径是否存在并将其添加到运行时类路径。或者,如果它实际上是您还没有的运行时依赖项(很可能是这种情况;)),那么很高兴知道包名称已经暗示您可以在 http://jdom.org 找到并下载它。 .

关于java - 在 Eclipse 中使用 JaCoP 时出现 NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2290841/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com