DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4

Thread: Applet Problem

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Posts
    7

    Applet Problem

    Hi everybody
    I was trying an applet program........it gets compiled but i am not able to run it.............
    i am sending u the code and the error mess. i got in comdprompt
    my code is
    import java.awt.*;
    import java.applet.*;
    public class Project1 extends Applet
    {
    public void paint (Graphics g)
    {
    g.setColor(Color.yellow);
    g.fillRect(0,0,300,300);
    g.setColor(Color.orange);
    g.fillOval(230,50,50,70);


    }
    }
    my html file code is
    <html>
    <head>
    <title>Project1</title>
    </head>
    <body>
    <center>
    <applet "code=Project1.class" width=500 height=500>
    </applet>
    </center>
    </body>
    </html>
    and these are the error messages:
    D:\j2sdk1.4.2_08\bin>javac Project1.java

    D:\j2sdk1.4.2_08\bin>java Project1
    Exception in thread "main" java.lang.NoSuchMethodError: main

    D:\j2sdk1.4.2_08\bin>set CLASSPATH=D:\j2sdk1.4.2_08\bin

    D:\j2sdk1.4.2_08\bin>appletviewer Project1.html
    load: class Project1.class" not found.
    java.lang.ClassNotFoundException: Project1.class"
    at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:162)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:566)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:619)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:548)
    at sun.applet.AppletPanel.run(AppletPanel.java:299)
    at java.lang.Thread.run(Thread.java:534)
    Caused by: java.io.FileNotFoundException: D:\j2sdk1.4.2_08\bin\Project1\class".class (The system cannot find the path sp
    ecified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileInputStream.<init>(FileInputStream.java:66)
    at sun.net.http://www.protocol.file.FileURLConn...ection.java:69)
    at sun.net.http://www.protocol.file.FileURLConn...ction.java:156)
    at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:274)
    at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:43)
    at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:152)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:149)

    Plz help me out
    Thanx in Advance
    Neer

  2. #2
    Join Date
    Oct 2004
    Location
    Chicago
    Posts
    108
    I believe you are missing the init() method

    This might help a little

    http://www.dgp.toronto.edu/~mjmcguff...-drawingLines/

  3. #3
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    load: class Project1.class" not found.
    java.lang.ClassNotFoundException: Project1.class"

    Its strange that there is a quote char at the end of the class name?

    Remove the "s around the "code=Project1.class" to be code=Project1.class
    and see what happens

  4. #4
    Join Date
    Oct 2005
    Posts
    7

    Thanx

    Hi
    Thanx very much for helping.........
    Neer

    Quote Originally Posted by Norm
    load: class Project1.class" not found.
    java.lang.ClassNotFoundException: Project1.class"

    Its strange that there is a quote char at the end of the class name?

    Remove the "s around the "code=Project1.class" to be code=Project1.class
    and see what happens

Similar Threads

  1. JavaMail applet problem
    By Tataroz T. in forum Java
    Replies: 1
    Last Post: 10-20-2005, 06:19 AM
  2. help needed on java program problem, please
    By Paul McCaffery in forum Java
    Replies: 0
    Last Post: 11-21-2002, 05:24 PM
  3. Replies: 0
    Last Post: 02-19-2002, 03:55 AM
  4. Call one applet from another
    By famin in forum Java
    Replies: 0
    Last Post: 05-05-2001, 08:48 AM
  5. Problem with Applet and Buttons - Please help!
    By John Syrakis in forum Java
    Replies: 0
    Last Post: 11-09-2000, 04:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links