r/javahelp • • May 12 '19

I can't execute java code after compiling

Hi there
Is there anyone that have come across this error:
Error:Could not find or load main class
Caused by: java.lang.ClassNotFoundException
I deleted and added the classpath reinstalled java but nothing has helped
The code compiles but it doesn't run

0 Upvotes

22 comments sorted by

View all comments

Show parent comments

1

u/morhp Professional Developer Aug 29 '19

It's probably not the same problem then. A ClassNotFoundException can have multiple causes. What is the exact stack trace? You probably just need to extend the classpath to include a dependency or something. How are you running the program?