get this error in the last 3-5 projects. but I don't get the error when I copy the same codes to another project. what is the reason of this? I'm new in the programming world and this mistake started to annoy :(
Asked
Active
Viewed 48 times
-3
-
https://hizliresim.com/grgn50 error picture – mebaysan Mar 13 '19 at 18:32
-
Don't post images of text, or your IDE. Copy/paste the relevant **text.** – Andrew Thompson Mar 14 '19 at 00:16
1 Answers
0
This error can have a couple of sources. I once wrote a blog post about it as I saw it so often on the NetBeans mailinglist:
- Ensure you have a public class containing a main method
- This class must have a well defined main method: “public static void main(String[] args) { }“
- You have set up the project configuration with the correct class: Project Properties > Run > Main Class (maybe just set it again, so that the project properties file is written again)
- Try to rebuild the project: Menu > Run > Clean & Build Main Project
- Still no success? Try renaming the class (Foo -> Foo1) and rename it back (Foo1 -> Foo). This should invalidate the NetBeans cache for this file (Just assuming – I am not a NetBeans Developer).
- Still no success?? You might to have to clear the NetBeans cache by deleting the directory “.netbeans6.8varcache” (the 6.8 might of course vary according to your version of NetBeans). Close NetBeans before deleting the cache – the next start might take some time as NB will most likely have to scan your code again.
- Still no luck? You might want to consult the NetBeans user forum or nbusers-Mailinglist (please be friendly, patient and report the bug in a way that others are able to help).
(copied from https://www.locked.de/no-main-class-found/ )

Mark Rotteveel
- 100,966
- 191
- 140
- 197

Locked
- 186
- 13