2010-02-18 50 views
0

我正在尝试在Eclipse项目中使用JaCoP。我已经导入库,并出现在构建路径,应用程序编译罚款,但是当它获取到需要的图书馆中,我得到以下错误点:在Eclipse中使用JaCoP时NoClassDefFoundError

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(); 

我真的很感激解决这个错误的任何帮助。

回答

2
java.lang.NoClassDefFoundError: org/jdom/Content 

这只是意味着特定的类是在运行时类路径缺失(而这是在编译时类路径,这与ClassNotFoundException的区别)。

逻辑的下一步将是在运行时类路径中包含特定的类(或者更具体地说,具有特定类的JAR文件)。然后这个错误将消失。

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

相关问题