• Register
0 votes
528 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 280 views
280 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 35 views
35 views
Problem: I am trying to open a CSV file but for some reason python cannot locate it. Here is my code (it's just a simple code but I cannot solve the problem): import csv with open('address.csv','r') as f: reader = csv.reader(f) for row in reader: print row
asked Jan 10 Mashhoodch 6.1k points
1 vote
1 answer 90 views
90 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 Jun 29, 2020 adamSw 11.3k points
0 votes
1 answer 8 views
0 votes
1 answer 11 views
11 views
Problem:hello, kodlogs audience I need your help as I am trying to access a file in java and I don't know how I would be able to that. Kindly help me it would great if you could explain with the help of code
asked Oct 12, 2020 anonymous
1 vote
1 answer 26 views
26 views
Problem: I wrote the following subclass for my main program: #include <stdio.h> #include <stdlib.h> #include "function.h" #define READFILE "r" #define WRITEFILE "w" #define WORDARRAYSIZE 16 #define MAXIMUMWORDCHARACTERS 15 void CreateWordList (char inputFileName [ ... completely useless in its remedial stages, but somewhere, the following error occurs, &ldquo;Undefined reference to main c++&rdquo;
asked Mar 9, 2020 Gavin 15.3k points
0 votes
2 answers 516 views
516 views
Problem : I am unable to figure out what is wrong with my code. When I try to compile my code I get the below message: &ldquo;Program does not contain a static 'main' method suitable for an entry point&rdquo;
asked Jan 29, 2020 jwilliam 3.9k points
0 votes
1 answer 6 views
6 views
Problem: Hi there! I am trying to run following program: using System; using System.IO; namespace ConsoleApp2 { class Program { public static void Main(string[] args) { FileStream fs = File.Open("e:\\file.txt", FileMode.Open); Console.ReadKey(); } ... .IOFileNotFoundException could not load file or assembly I want to know why these exceptions are thrown by the compiler and how to resolve them?
asked Dec 4, 2020 Code Learner 5.5k points
0 votes
1 answer 9 views
9 views asked Oct 17, 2020 SapperIt 1.2k points
0 votes
1 answer 587 views
587 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