954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

java.lang.NoSuchMethodError

hi
im a beginner in Java
i have make a simple program using the JCreator LE
but when i execute file the error below is shown in the command prompt
Exception in thread "main" java.lang.NoSuchMethodError: main
may i know what is the matter?
thank you in advance

shingo99
Newbie Poster
2 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

hello all...

I have just started with java and am having the same trouble..

it compiles alright.. but at runtime.. it gives this error...

can anybody help with how it can be solved...


---> MY CODE<----

import java.applet.*;
import java.awt.*;

public class tutorial extends Applet
{
public void pain(Graphics g)
{
g.drawString("Hello",20,20);
}
}

udit611
Newbie Poster
2 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

That means there is no method matching the signature you gave. It could be a parameter missing, a mispelling, or a number of problems.

udit,
you forget the t in paint:

public void pain(Graphics g)

change to;

public void paint(Graphics g)

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

You might have misspelt the method name or might have referred to a class hat doesn't exist at all. Post you code to pin-point the error exactly.

techy
Newbie Poster
18 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

hi,
does your class has main method with the following signature?


[HTML]
public static void main(String args[])
{
}
[/HTML]
regards
srinivas

cheenu78
Light Poster
45 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

thanks a lot to help


_______________________________
Senswell
RumahParfum
Itvisione
Make Money Online

archangeloft
Newbie Poster
1 post since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

Hello there,

im begineer too, but i found coding is not the matter, please read JCreator Help Contents, u will find JC doesnt have applet viewer, u must insert manually class filename into html applet template provided, then run that html file as usual, why not switch to TextPad, simple & lightweight yet applet viewer builtin

mrdsys
Newbie Poster
1 post since Mar 2007
Reputation Points: 10
Solved Threads: 0
 
Hello there, im begineer too, but i found coding is not the matter, please read JCreator Help Contents, u will find JC doesnt have applet viewer, u must insert manually class filename into html applet template provided, then run that html file as usual, why not switch to TextPad, simple & lightweight yet applet viewer builtin


Unless you're FORCED to use JCreator, try Eclipse . It has everything and then some more..

thekashyap
Practically a Posting Shark
811 posts since Feb 2007
Reputation Points: 254
Solved Threads: 75
 

hey,

me gting d same Error pls help me out with dis....

the program i tried as follows pls refer..
the error is Exceptio in thread "main" java.lang.......

import java.io.*;
class A extends Thread
{
public void run()
{
for(int i=0;i<10;i++)
{
System.out.println("Hello");
}
}
}
class B extends Thread
{
public void run()
{
int i;
for(i=0;i<10;i++)
{
System.out.println("Hi");
}
}
}
class Hiral
{
public static void main (String args[])
{
System.out.println("hello");

A a1=new A();
B b1=new B();
a1.start();
b1.start();
}
}

hiralchheda
Newbie Poster
2 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

hey,

me gting d same Error pls help me out with dis....

the program i tried as follows pls refer..
the error is Exceptio in thread "main" java.lang.......

import java.io.*;
class A extends Thread
{
public void run()
{
for(int i=0;i<10;i++)
{
System.out.println("Hello");
}
}
}
class B extends Thread
{
public void run()
{
int i;
for(i=0;i<10;i++)
{
System.out.println("Hi");
}
}
}
class Hiral
{
public static void main (String args[])
{
System.out.println("hello");

A a1=new A();
B b1=new B();
a1.start();
b1.start();
}
}

hiralchheda
Newbie Poster
2 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

Please use "[CODE]" to post code. It makes it a lot easier to read! Also, try to write better English. It is hard to understand what you write.

Cort3z
Junior Poster in Training
56 posts since Oct 2009
Reputation Points: 10
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You