Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

Newb Question

Thread view: 
Dagorlas - 28 Jun 2006 07:43 GMT
Im learning java, and i build a simple applet...
I compiled it into *.class and now, when i run it, i got the following
error:

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

How can i fix this? the code of the applet is this:

import java.awt.*;

public class RootApplet extends javax.swing.JApplet {
   int number;

   public void init() {
       number = 225;
   }

   public void paint(Graphics screen) {
       Graphics2D screen2D = (Graphics2D) screen;
       screen2D.drawString("the square root of " +
           number +
           " is " +
           Math.sqrt(number), 5, 50);
   }
}

I hope some1 can help me
Paul Hamaker - 28 Jun 2006 08:37 GMT
An applet is run through its HTML in appletviewer or in a plugged
browser.
You are trying to run it as a standalone, which can't be done if it's
just an applet.
http://javalessons.com/cgi-bin/fun/java-tutorials-main.cgi?ses=ao789
lookup 2. Compile and run, 36.Stand-alone application.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.