Click here to Skip to main content
14,301,527 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi, i just created a “Main” java class in intellij i'm basically following tutorials of udacity but when i tried to run it the button was disabled and then i tried to edit configuration and it said "Main is not acceptable" it said Main is not acceptable can someone tell me why is it happening?


My code is:

public class Main {
public static void main(String args){
System.out.println("Hello world!");
}
}


What I have tried:

I have tried edit configurations but i didn't let me do that.
Posted
Updated 26-Aug-19 0:10am
Comments
Richard MacCutchan 26-Aug-19 6:15am
   
Also, for future reference: please include the full exact text of the error message, which line it refers to, and whether it is compile or run time.
Richard MacCutchan 26-Aug-19 10:31am
   
Please edit your question and show us the exact error message, and where it occurs.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 2

I would try
public static void main(String[] args)
instead.
   
Comments
Richard MacCutchan 26-Aug-19 6:16am
   
Oops, I missed that.
phil.o 26-Aug-19 6:18am
   
Everyone of us might have missed that kind of typo at least once :)
Thanks for the vote.
johnlearner 26-Aug-19 6:20am
   
hi i have tried public static void main(String[] args) but still the error is same
phil.o 26-Aug-19 6:42am
   
Not knowing the exact steps you followed to create your project, it is hard to provide a proper answer. Did you try to compile the project before editing its configuration? Did you try to set (or reset) the project's root? Is the file located in this root?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100