Results 1 to 2 of 2
  1. #1
    Gio D. is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default Help with a tutorial applet

    My friend is helping me learn Java Applets, and showed me a link to his site here:
    Applet Demo
    I am using the source as a .java written with Notepad, with the same name as the class. then I make a .HTML based on the Source Code of the page. However, when I open the .HTML, it says "error: click for details" where the Applet should be. I click it, and it says this:
    Java Plug-in 1.6.0_18
    Using JRE version 1.6.0_18-b07 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\Gio
    ----------------------------------------------------
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    ----------------------------------------------------


    load: class AppletDemo not found.
    java.lang.ClassNotFoundException: AppletDemo
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Un known Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unk nown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unk nown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.FileNotFoundException: C:\Documents and Settings\Gio\My Documents\Java Programs\Tests\AppletDemo.class (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at sun.net.http://www.protocol.file.FileURLConn...onnect(Unknown Source)
    at sun.net.http://www.protocol.file.FileURLConn...Stream(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unk nown Source)
    at sun.plugin2.applet.Applet2ClassLoader.access$000(U nknown Source)
    at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknow n Source)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 7 more
    Exception: java.lang.ClassNotFoundException: AppletDemo


    if anyone can help me, it would be greatly appriceated. I am learning how to write Applets and do not know alot about it.

  2. #2
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    366
    Rep Power
    6

    Default

    Quote Originally Posted by Gio D. View Post
    I am using the source as a .java written with Notepad
    When you write source code file extension is like MyApplet.java.
    You have to compile your source file. Use some java tool.
    Then you get class file like MyApplet.class

    You have to use *.class files and not *.java files with your html files.
    Be sure html and *.class are in same folder !

    When you write html and you use applet tag like this (.class mat be omitted)

    <applet code = "MyApplet.class"
    height = "150"
    width = "300" >
    </applet>

    better now?

    Use official tutorial for learning :

    Lesson: Applets (The Java™ Tutorials > Deployment)

Similar Threads

  1. Need help with my tutorial
    By annna in forum New To Java
    Replies: 2
    Last Post: 02-05-2010, 04:00 PM
  2. Tutorial help LAST QNS
    By annna in forum New To Java
    Replies: 2
    Last Post: 01-28-2010, 01:22 PM
  3. web tutorial
    By poobeer in forum Web Frameworks
    Replies: 1
    Last Post: 10-24-2009, 03:10 AM
  4. ejb tutorial
    By marcellis in forum Enterprise JavaBeans (EJB)
    Replies: 3
    Last Post: 09-30-2009, 02:43 PM
  5. Applet Login System Tutorial
    By Free-JavaTutorials in forum Java Applets
    Replies: 0
    Last Post: 03-15-2008, 03:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •