Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
1.00/5 (1 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:

Java
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

I would try
Java
public static void main(String[] args)
instead.
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900