0

I want to run DepthFirstSearch.java from the following website: https://algs4.cs.princeton.edu/code/edu/princeton/cs/algs4/DepthFirstSearch.java

I put it in a folder new with the algs4.jar from the above website. I use the following to compile in WINDOWS: javac -cp algs4.jar DepthFirstSearch.java which compiles correctly. However, when I run java -cp algs4.jar DepthFirstSearch I get the error that main class could not found or load. Does anyone know how I can solve this? Best Regards,

theBittor
  • 786
  • 1
  • 11
  • 20
Carol
  • 13
  • 5
  • 1
    `java -cp algs4.jar edu.princeton.cs.algs4.DepthFirstSearch` - The package is part of the class name. – Elliott Frisch Jun 01 '20 at 23:24
  • 1
    Does this answer your question? [What does "Could not find or load main class" mean?](https://stackoverflow.com/questions/18093928/what-does-could-not-find-or-load-main-class-mean) – rph Jun 01 '20 at 23:25
  • @ElliottFrisch Thank you I tried. It worked. – Carol Jun 01 '20 at 23:28
  • @rph my question was specifically for java codes from the mentioned website. However, the link that you sent can cover it. – Carol Jun 02 '20 at 00:18

0 Answers0