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

3

u/desrtfx Out of Coffee error - System halted May 12 '19

Is your .java file (and consecutively, your .class file) named exactly the same as the class that contains the public static void main(String[] args) method (including spelling and capitalization)? Is the class public?

You're not giving us sufficient information to be able to help.

1

u/TalxTrapi May 12 '19

Is a simple Hello world program They are named exactly the same

2

u/desrtfx Out of Coffee error - System halted May 12 '19

Show your code, please.