Skip to main content
The 2024 Developer Survey results are live! See the results

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • Does the colon need to be a semicolon on windows? Commented Mar 3, 2022 at 14:08
  • 1
    Yes, it does, @ThomasStokes
    – ernest_k
    Commented Mar 3, 2022 at 14:09
  • I try this but I get an error : "Could not find or load main class" How can java find the main class name in the right package ?
    – Nab
    Commented Feb 1 at 18:33
  • @Nab Are you typing the fully qualified class name (with packages)? The only other reason would be that the class is not in the jar.
    – ernest_k
    Commented Feb 5 at 7:03
  • My bad, as I am running this on windows, the correct command is : java -cp "MyJar.jar;lib*" com.somepackage.subpackage.Main
    – Nab
    Commented Feb 5 at 10:02