Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Exception in thread "main" java.lang.nosuchmethoderror: main

843807Jan 14 2009 — edited Jan 15 2009
Hello,

i compile code successfully but at the time when i run it can give the error
*"Exception in thread "main" java.lang.nosuchmethoderror: main"*
if i write the main method it can give exception at the very first line of the code
Please define clearly main in code how can i use and run my code



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

public class JavaDraw extends NoFlickerApplet --------- error in NoFlickerApplet
{
public static final int LINE = 1;
public static final int RECT = 2;
public static final int OVAL = 3;
public static final int SELECT = 4;


AGroupObject theDrawing;

ADrawObject currentObject;
private int drawMode = 1;
private int lastX, lastY;
private int downX, downY;
Button line, rect, oval, select, delete;

public void init()
{
setLayout(new BorderLayout());
Panel ledge = new Panel();
ledge.setLayout(new FlowLayout());

line = new Button("line");
ledge.add(line);

rect = new Button("rect");
ledge.add(rect);

oval = new Button("oval");
ledge.add(oval);

select = new Button("select");
ledge.add(select);

delete = new Button("delete");
ledge.add(delete);

add("North", ledge);
}

public void start()
{
theDrawing = new AGroupObject();
repaint();
}

public void stop()
{
}

public void paint(Graphics g)
{
g.setColor(Color.white);
g.fillRect(0, 0, size().width - 1, size().height - 1);
g.setColor(Color.black);
if (theDrawing != null)
{
theDrawing.Paint(g, false);
g.setColor(Color.white);
g.setXORMode(Color.gray);
theDrawing.DrawHandles(g);
g.setPaintMode();
}
}
}


Regards,
Nansu
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 12 2009
Added on Jan 14 2009
6 comments
158 views