Programmers learn & share
0 votes

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)   | 96 views

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 (36.1k points)  
edited by
2,183 questions
2,488 answers
241 users