main class could not be found or loaded code example
Example: java error main class could not be found
For me the issue was that my classpath was not set correctly, then you have to add the classpath with -cp:
java -cp <Full Directory / FilePath> <Name of the ClassFile>