• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
7 views

Problem :

In my code have main method in it. The program compiles on jgrasp with no errors but it keeps giving me a message as bellow:
"no main methods, applets, or Midlets found in file jgrasp"
by (6.9k points)  

1 Answer

0 votes

Solution :


The java program needs the specific main() method defined in the class that is passed to it. If the commandline is:
java TheClass then TheClass class must have the main() method.
The main() method in your code is NOT the one required by java. 

Syntax for main method in Java :

public static void main(String[] args)

{

}

This main method is called whenever a java program is started. The only exception is in applets, where they're not calling "main" but "init".

by (20.3k points)  
edited by
...