• Register
0 votes
924 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"
6.9k points

Please log in or register to answer this question.

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".

38.6k points
edited by

Related questions

0 votes
1 answer 13 views
13 views
Problem: I'm trying to figure out a solution, need help : No main methods javafx applications applets or midlets found in file.
asked Jun 18 Florina Gulnar 106k points
0 votes
2 answers 917 views
917 views
Problem : I got bellow message from my code Exception in thread "main" java.lang.ArithmeticException: / by zero
asked Nov 1, 2019 peterlaw 6.9k points
0 votes
1 answer 92 views
92 views
Problem: Hi there! I was writing the code for practicing file management in Java. When I executed one of my programs, it threw the following exception: java.io.IOException: The filename, directory name, or volume label syntax is incorrectI want to know the possible reason ... problem was solved, but he did not explain to me the reason for the exception so seeking help from the kodlogs. Thank you!
asked May 26 Code Learner 10.5k points
0 votes
1 answer 20 views
20 views
Problem: Is anyone available to assist me and resolve this issue? Could not find or load main class java cmd
asked May 19 Ifra 43.4k points
0 votes
1 answer 23 views
23 views
Problem: I have got an error: could not find or load main class. Who can help me to fix it?
asked Mar 27 ashik 14.6k points
0 votes
1 answer 14 views
14 views
Problem: I have found an error: could not find or load main class main.Help me to fix it.
asked Mar 27 ashik 14.6k points
0 votes
1 answer 25 views
25 views
Problem: What kind of error showing my computer I dont understand> could not find or load main class test? somebody please help me.
asked Mar 27 ashik 14.6k points
0 votes
1 answer 12 views
12 views
Problem: I need someone to understand this problem and find out the solution of error: could not find or load main class undefined.
asked Mar 27 ashik 14.6k points
0 votes
1 answer 111 views
111 views
Problem: Caused by: java.lang.noclassdeffounderror: javafx/application/application.
asked May 6 Ryan evans 1.6k points
0 votes
1 answer 2 views
2 views
Problem: Public static void main string args meaning?
asked Jul 10 Nahil 128k points