-1

Main class:

package org.example;

public class Main {
     public static void main(String[] args) {
   }
}

is located at project\src\main\java\org\example\Main.java

I go over project\src\main\java\ directory and apply:

java org.example.Main

And get: Could not find or load main class org.example.Main

I tried also:

java -classpath org/example Main

And:

java -classpath ../../../ org/example/Main

But with the same result. I'm using gradle for build.

What am I doing wrong?

Jelly
  • 972
  • 1
  • 17
  • 40
  • 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) – Torben Apr 20 '23 at 09:22

1 Answers1

0

You need to run the command java org.example.Main in the output folder.