• Register
search
Log In
0 votes
122 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

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

36.1k points
edited by

Related questions

0 votes
2 answers 51 views
51 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
1 vote
1 answer 16 views
16 views
Problem: Hello Kodlogs, I just joined this forum. I found you people knowledgeable and friendly alongside. Well, I am a new python developer. Well, it could be exaggerative if I address me as a developer, I am a new student perhaps. I have to learn a lot ... The above open command producing an error of filenotfounderror: [errno 2] no such file or directory: But why? Could you identify the problem?
asked 3 days ago adamSw 8.2k points
0 votes
1 answer 194 views
194 views
Problem : I am getting the run time exception in my program while I am reading a file through a Scanner. exception in thread "main" java.util.nosuchelementexception: no line found
asked Oct 23, 2019 peterlaw 6.9k points
0 votes
1 answer 254 views
254 views
Problem : I want to input some of the details about student to my program. But when I press a save button its giving me the below listed exception error: "Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not supported yet."
asked Jan 31 jwilliam 3.9k points
0 votes
1 answer 273 views
273 views
Problem : I am facing a problem with the exception handling in Java, following is my code. I am facing compiler error when I try to execute my code. The error is as below: exception MojException is never thrown in body of corresponding try ... MyMojException: public class MyMojException extends Exception{ MyMojException(String str){ super(str); } } Can anyone suggest solution on my issue?
asked Dec 5, 2019 alecxe 7.5k points