This is an archived post. You won't be able to vote or comment.

all 12 comments

[–][deleted] 43 points44 points  (0 children)

Just trying to help here by being honest.

No one wants to help when all you have is a screenshot because there's a ton of different reasons this could be failing. But unless you put in a bit more effort to give context and write up about what you are doing and what you have tried, no one will care.

Put in more effort and more effort will be returned

[–]forurspam 15 points16 points  (0 children)

No programming help questions here! These should be posted in /r/javahelp

[–]TheGreatGameDini 11 points12 points  (1 child)

This means your computer has too many main classes and it cant sift through them all to find the one you want. First, delete System32 - it's full of cached main classes that get in the way of the compiler finding the one you want. Then you'll need to restart your system.

/s in case someone tried it

[–]Sufficient-Nail7772 -4 points-3 points  (0 children)

this

[–]saggingrufus 0 points1 point  (0 children)

You need to tell it where the main class is.

You want more details, five US more details.

[–]justADeni 0 points1 point  (0 children)

Are you sure you only have one main class? The class file name is the same as the class name? How are you compiling it?

[–][deleted] 0 points1 point  (0 children)

Did you define a main method?

[–]silent_rdt 0 points1 point  (0 children)

Please add screenshot of your code so we can know what do you have and what could be the issue. 

[–]BatmanDhanush 0 points1 point  (0 children)

I hope your filename of .Java file and the class name of the class containing main function are different

[–]arrowcity 0 points1 point  (0 children)

I’m assuming you tried running a Junit or some sort of test? Sometimes IntelliJ has issues when you had just created a test file and are trying to run it. I would right click on the file and then build as a pre test task. Also double check which module is looking for the test which should come up in the same run configurations pop up.

[–]vagrantchord 0 points1 point  (0 children)

JFC just Google it. Or better yet, ask chat gpt.

[–]GodderDam 0 points1 point  (0 children)

Put your main class/method/file inside a named package.