Compiling the demos

50 views
Skip to first unread message

Dana Hurlbut

unread,
Apr 28, 2012, 9:04:55 AM4/28/12
to cs310_s12
Is anyone else having trouble compiling DFSDemo and TopSortDemo? They
work fine in eclipse, but when I try to compile them in putty I get a
million errors, saying all these classes (DefaultEdge, DirectedGraph,
etc) don't exist. I didn't make any changes to DFSDemo at all so I'm
really confused.

Jordan Hourani

unread,
Apr 28, 2012, 4:45:51 PM4/28/12
to cs31...@googlegroups.com
I got them to work in UNIX, does that help? I dont use putty sorry...

Jordan Hourani

unread,
Apr 28, 2012, 4:47:28 PM4/28/12
to cs31...@googlegroups.com
actually dont listen to me, I am getting this in UNIX for DFSDemo :

blade57(42)% java cs310.DFSDemo
numEdges = 45
Exception in thread "main" java.lang.NoClassDefFoundError: org/jgraph/JGraph
        at cs310.DFSDemo.runDemo(DFSDemo.java:68)
        at cs310.DFSDemo.main(DFSDemo.java:143)

The other ones work fine, but I cant get this one running either.

Paul Miley

unread,
Apr 28, 2012, 9:27:40 PM4/28/12
to cs31...@googlegroups.com
I am having a similar problem in NetBeans.  I have imported all necessary classes but TopSortTest won't compile with DefaultEdge, Says:

constructor TopSort in class cs310.TopSort<V,E> cannot be applied to given types;
  required: org.jgrapht.DirectedGraph<java.lang.String,org.jgrapht.graph.DefaultEdge>
  found: org.jgrapht.Graph<java.lang.String,org.jgrapht.graph.DefaultEdge>
  reason: actual argument org.jgrapht.Graph<java.lang.String,org.jgrapht.graph.DefaultEdge> cannot be converted to org.jgrapht.DirectedGraph<java.lang.String,org.jgrapht.graph.DefaultEdge> by method invocation conversion

Betty O'Neil

unread,
Apr 29, 2012, 11:46:37 AM4/29/12
to cs310_s12
You probably forgot the needed . in the classpath. Once you use
-cp path to get the jgraph.jar in the classpath, you also need .,
-cp path:. on UNIX, -cp path;. on Windows, where I'm assuming
your current dir is at the top of the .class directory system.

The reason is that . is the default classpath, but when you
override the classpath with -cp path, you need to put it back
in the new path explicitly.

Betty O'Neil

unread,
Apr 29, 2012, 11:48:46 AM4/29/12
to cs310_s12

Sounds like you're trying to downcast Graph to DirectedGraph by
feeding a Graph type variable to an argument that expects
DirectedGraph.

Betty O'Neil

unread,
Apr 29, 2012, 11:40:58 AM4/29/12
to Paul Miley, cs31...@googlegroups.com
Sounds like you're trying to downcast Graph to DirectedGraph by
feeding a Graph type variable to an argument that expects DirectedGraph.

Betty O'Neil

unread,
Apr 28, 2012, 2:14:23 PM4/28/12
to Dana Hurlbut, cs310_s12
You probably forgot the needed . in the classpath. Once you use
-cp path to get the jgraph.jar in the classpath, you also need .,
-cp path:. on UNIX, -cp path;. on Windows, where I'm assuming
your current dir is at the top of the .class directory system.

The reason is that . is the default classpath, but when you
override the classpath with -cp path, you need to put it back
in the new path explicitly.

Christopher G Kelly 5

unread,
May 1, 2012, 12:14:33 AM5/1/12
to cs31...@googlegroups.com
I'm having the same issue when I try to run TopSortDemo in UNIX
-Chris

From: cs31...@googlegroups.com [cs31...@googlegroups.com] on behalf of Jordan Hourani [jordan...@gmail.com]
Sent: Saturday, April 28, 2012 4:47 PM
To: cs31...@googlegroups.com
Subject: Re: Compiling the demos

Reply all
Reply to author
Forward
0 new messages