error: could not find or load main class
-
0 down vote favorite on my ubuntu terminal i was trying to compile and run the program like this javac -cp "/usr/lib/jvm/jdk1.8.0_20/lib/gs-core-1.2.jar" GraphExplore.java successfully compiled.now to run java -cp "/usr/lib/jvm/jdk1.8.0_20/lib/gs-core-1.2.jar" GraphExplore I got error saying Error: Could not find or load main class GraphExplore I am newbee in java.please someone help me to resovle this issue.thanks in advance.what i tried to resolve this error.i kept .class file in one folder and run i mean i kept in one path and tried to execute in that path only but it didnt work.please help me
-
0 down vote favorite on my ubuntu terminal i was trying to compile and run the program like this javac -cp "/usr/lib/jvm/jdk1.8.0_20/lib/gs-core-1.2.jar" GraphExplore.java successfully compiled.now to run java -cp "/usr/lib/jvm/jdk1.8.0_20/lib/gs-core-1.2.jar" GraphExplore I got error saying Error: Could not find or load main class GraphExplore I am newbee in java.please someone help me to resovle this issue.thanks in advance.what i tried to resolve this error.i kept .class file in one folder and run i mean i kept in one path and tried to execute in that path only but it didnt work.please help me
-
import org.graphstream.graph.*;
import org.graphstream.graph.implementations.*;
import java.util.Iterator;public class GraphExplore {
public static void main(String args[]) {
new GraphExplore();
}public GraphExplore() { Graph graph = new SingleGraph("tutorial 1"); graph.addAttribute("ui.stylesheet", styleSheet); graph.setAutoCreate(true); graph.setStrict(false); graph.display(); graph.addEdge("AB", "A", "B"); graph.addEdge("BC", "B", "C"); graph.addEdge("CA", "C", "A"); graph.addEdge("AD", "A", "D"); graph.addEdge("DE", "D", "E"); graph.addEdge("DF", "D", "F"); graph.addEdge("EF", "E", "F"); for (Node node : graph) { node.addAttribute("ui.label", node.getId()); } explore(graph.getNode("A")); } public void explore(Node source) { Iterator k = source.getBreadthFirstIterator(); while (k.hasNext()) { Node next = k.next(); next.setAttribute("ui.class", "marked"); sleep(); } } protected void sleep() { try { Thread.sleep(1000); } catch (Exception e) {} } protected String styleSheet = "node {" + " fill-color: black;" + "}" + "node.marked {" + " fill-color: red;" + "}";
}
-
0 down vote favorite on my ubuntu terminal i was trying to compile and run the program like this javac -cp "/usr/lib/jvm/jdk1.8.0_20/lib/gs-core-1.2.jar" GraphExplore.java successfully compiled.now to run java -cp "/usr/lib/jvm/jdk1.8.0_20/lib/gs-core-1.2.jar" GraphExplore I got error saying Error: Could not find or load main class GraphExplore I am newbee in java.please someone help me to resovle this issue.thanks in advance.what i tried to resolve this error.i kept .class file in one folder and run i mean i kept in one path and tried to execute in that path only but it didnt work.please help me
-
import org.graphstream.graph.*;
import org.graphstream.graph.implementations.*;
import java.util.Iterator;public class GraphExplore {
public static void main(String args[]) {
new GraphExplore();
}public GraphExplore() { Graph graph = new SingleGraph("tutorial 1"); graph.addAttribute("ui.stylesheet", styleSheet); graph.setAutoCreate(true); graph.setStrict(false); graph.display(); graph.addEdge("AB", "A", "B"); graph.addEdge("BC", "B", "C"); graph.addEdge("CA", "C", "A"); graph.addEdge("AD", "A", "D"); graph.addEdge("DE", "D", "E"); graph.addEdge("DF", "D", "F"); graph.addEdge("EF", "E", "F"); for (Node node : graph) { node.addAttribute("ui.label", node.getId()); } explore(graph.getNode("A")); } public void explore(Node source) { Iterator k = source.getBreadthFirstIterator(); while (k.hasNext()) { Node next = k.next(); next.setAttribute("ui.class", "marked"); sleep(); } } protected void sleep() { try { Thread.sleep(1000); } catch (Exception e) {} } protected String styleSheet = "node {" + " fill-color: black;" + "}" + "node.marked {" + " fill-color: red;" + "}";
}
-
import org.graphstream.graph.*;
import org.graphstream.graph.implementations.*;
import java.util.Iterator;public class GraphExplore {
public static void main(String args[]) {
new GraphExplore();
}public GraphExplore() { Graph graph = new SingleGraph("tutorial 1"); graph.addAttribute("ui.stylesheet", styleSheet); graph.setAutoCreate(true); graph.setStrict(false); graph.display(); graph.addEdge("AB", "A", "B"); graph.addEdge("BC", "B", "C"); graph.addEdge("CA", "C", "A"); graph.addEdge("AD", "A", "D"); graph.addEdge("DE", "D", "E"); graph.addEdge("DF", "D", "F"); graph.addEdge("EF", "E", "F"); for (Node node : graph) { node.addAttribute("ui.label", node.getId()); } explore(graph.getNode("A")); } public void explore(Node source) { Iterator k = source.getBreadthFirstIterator(); while (k.hasNext()) { Node next = k.next(); next.setAttribute("ui.class", "marked"); sleep(); } } protected void sleep() { try { Thread.sleep(1000); } catch (Exception e) {} } protected String styleSheet = "node {" + " fill-color: black;" + "}" + "node.marked {" + " fill-color: red;" + "}";
}
Since your main declaration looks correct, it most likely the compile was not successful. Look in the directory where you are compiling. See if the file GraphExplore.class was created. You will get that message if it is not being created as a result of an error. As a further experiment, try misspelling the name when you run it, you will see that it is the exact same error.
-
0 down vote favorite on my ubuntu terminal i was trying to compile and run the program like this javac -cp "/usr/lib/jvm/jdk1.8.0_20/lib/gs-core-1.2.jar" GraphExplore.java successfully compiled.now to run java -cp "/usr/lib/jvm/jdk1.8.0_20/lib/gs-core-1.2.jar" GraphExplore I got error saying Error: Could not find or load main class GraphExplore I am newbee in java.please someone help me to resovle this issue.thanks in advance.what i tried to resolve this error.i kept .class file in one folder and run i mean i kept in one path and tried to execute in that path only but it didnt work.please help me
in your buildpath,it need load jar ,so u upload this jar in your project, and then server will building it,