如果有多个边,我正在努力在两个节点上显示两条边。我正在关注这个例子。但我面临一个例外:
线程“main”中的异常 java.lang.NoClassDefFoundError: scala/collection/convert/WrapAsScala at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at org.graphstream .ui.view.Viewer.newGraphRenderer(Viewer.java:349) at org.graphstream.graph.implementations.AbstractGraph.display(AbstractGraph.java:753) at org.graphstream.graph.implementations.AbstractGraph.display(AbstractGraph.java :747) 在 com.h2Database.app.ahd.main(ahd.java:18) 引起:java.lang.ClassNotFoundException: scala.collection.convert.WrapAsScala at java.net.URLClassLoader.findClass(URLClassLoader.java:381 ) 在 java.lang.ClassLoader.loadClass(ClassLoader.java:424) 在 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) 在 java.lang.ClassLoader.loadClass(ClassLoader.java:357) .. .还有 6 个
我的代码是:
import org.graphstream.graph.*;
import org.graphstream.graph.implementations.*;
import org.graphstream.ui.view.Viewer;
public class ahd {
public static void main(String args[]) {
Graph graph = new MultiGraph("Test");
System.setProperty("org.graphstream.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer");
graph.addNode("A");
graph.addNode("B");
graph.addEdge("1", "A", "B", true);
graph.addEdge("2", "A", "B", true);
Viewer viewer = graph.display();
}
}
任何想法,为什么我要面对这个?似乎在给定的示例中此问题已解决。