• Register
0 votes
707 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 5 3
6,930 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".

9 7 4
38,600 points

Related questions

0 votes
2 answers 522 views
522 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 7 views
7 views
Problem: Any ideas on what I need to fix the error: could not find or load main class main caused by: java.lang.classnotfoundexception: main?
asked Mar 27 ashik 11.2k points
0 votes
1 answer 4 views
4 views
problem; so please help me out un this question.why do we write public static void main in java
asked Mar 22 Sana8989 8.9k points
0 votes
1 answer 5 views
5 views
Problem: Why is the Java main method static? Is there a reason for this method to be static? Thanks in advance
asked Mar 8 ummesalma 24.5k points
0 votes
1 answer 3 views
3 views
Problem: Can anyone tell me the solution of this problem? public static void main string args meaning
asked Mar 26 Ifra 24.4k points
0 votes
1 answer 5 views
5 views
Problem: I need someone to understand this problem and find out the solution... java could not load main class
asked Mar 25 Ifra 24.4k points
0 votes
1 answer 4 views
4 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 11.2k points
0 votes
1 answer 7 views
7 views
Problem: I have found an error: could not find or load main class main.Help me to fix it.
asked Mar 27 ashik 11.2k points
0 votes
1 answer 4 views
4 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 11.2k points
0 votes
1 answer 5 views
5 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 11.2k points