2010-02-18 21 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找到並下載它。

相關問題