java - JUNG Exception in "main" :org/apache/commons/collections/Predicate -
i getting started java universal network/graph framework (jung). trying build basic graph using same. downloaded jung 2.0.1 libraries. collections-generic-4.0.1.jar , colt-1.2.0.jar. added included libraries eclipse project build path. getting following exception whenever trying run...
package grapheditor; import edu.uci.ics.jung.graph.graph; import edu.uci.ics.jung.graph.sparsemultigraph; import edu.uci.ics.jung.graph.util.edgetype; /** * simplest jung2 graph creation example possible? * shows how easy new jung2 graph interface , implementation class * use. * @author dr. greg m. bernstein */ public class simplestgraph { public static void main(string[] args) { // graph<v, e> v type of vertices , e type of edges sparsemultigraph<integer, string> g = new sparsemultigraph<integer, string>(); // add vertices. above defined these type integer. g.addvertex((integer)1); g.addvertex((integer)2); g.addvertex((integer)3); // add edges. above defined these of type string // note default undirected edges. g.addedge("edge-a", 1, 2); // note java 1.5 auto-boxes primitives g.addedge("edge-b", 2, 3); // let's see have. note nice output sparsemultigraph<v,e> tostring() method system.out.println("the graph g = " + g.tostring()); // note can use same nodes , edges in 2 different graphs. sparsemultigraph<integer, string> g2 = new sparsemultigraph<integer, string>(); g2.addvertex((integer)1); g2.addvertex((integer)2); g2.addvertex((integer)3); g2.addedge("edge-a", 1,3); g2.addedge("edge-b", 2,3, edgetype.directed); g2.addedge("edge-c", 3, 2, edgetype.directed); g2.addedge("edge-p", 2,3); // parallel edge system.out.println("the graph g2 = " + g2.tostring()); } }
i getting following exception:
exception in thread "main" java.lang.noclassdeffounderror: org/apache/commons/collections/predicate @ grapheditor.simplestgraph.main(simplestgraph.java:17) caused by: java.lang.classnotfoundexception: org.apache.commons.collections.predicate @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) ... 1 more
it made me thinking collections-generic-4.0.1.jar causing it. extracted , found package structure in org/apache/commons/collections15/predicate instead of org/apache/commons/collections/predicate. causing problem? in light appreciated...
write in code specify want predicate class from:
import org.apache.commons.collections15.predicate
or if may need other classes inside package:
import org.apache.commons.collections15.*
also, can extract .jar file , create new 1 correct path predicate
class.
Comments
Post a Comment