Results 1 to 1 of 1
  1. #1
    Krooger is offline Member
    Join Date
    Nov 2008
    Rep Power

    Default [SOLVED] .jsp wont find my applet.class Whats going on?

    I'm using Eclipse and Tomcat. I cannot figure out how my directory is suppose to be structured.
    The now.jsp loads as it is suppose to in my browser, but it cannot load the embedded applet.

    This is my structure:
    Java Code:
          now.jsp                     <--- JSP File
              client                    <--- Package name
                FirstApplet.class    <--- Applet
    This is my jsp code:
    Java Code:
    <%@ page import="java.util.Date" %>
             Date now = new Date();
    <jsp:plugin type="applet" code="FirstApplet.class" 
      width="400" height="400">
       <p>Unable to load applet</p>
    this is the error I get from the webpage when it tries to load the applet.

    Java Code:
    Java Plug-in 1.6.0_22
    Using JRE version 1.6.0_22-b04 Java HotSpot(TM) Client VM
    User home directory = C:\Users\owner
    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 FirstApplet.class not found.
    java.lang.ClassNotFoundException: FirstApplet.class
    	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager$ Source)
    	at Source)
    Caused by: open HTTP connection failed:http://localhost:8080/website/FirstApplet/class.class
    	at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
    	at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
    	at sun.plugin2.applet.Applet2ClassLoader$ Source)
    	at Method)
    	... 9 more
    Exception: java.lang.ClassNotFoundException: FirstApplet.class

    From the reading I have been doing I get that my applet isn't suppose to be in WEB-INF because Tomcat won't let a client access that, but I have tried putting FirstApplet.class in every single folder and also since it was written to be packaged into "client" I have also tried making a client folder and putting FirstApplet.class in it and for the life of my i cannot get this applet to be found.

    Anyone know what I am doing wrong?

    - Thank You.


    Should anyone come across this with a similar problem this was the answer for my case.

    Since my applet was packaged under the name client.FirstApplet.class I needed to add a folder called "client" in the same dir as the webpage file.
    I then needed to add FirstApplet.class into that folder.
    The .jsp or .html then needed to call the applet with the following line:
    Java Code:
    <jsp:plugin type="applet" code="client.FirstApplet.class" 
      width="400" height="400">
       <p>Unable to load applet</p>
    including the package name.
    Last edited by Krooger; 05-08-2012 at 07:08 AM. Reason: Solved

Similar Threads

  1. Applet Wont Show Supposed Output, Please Help
    By bdmchamp in forum Java Applets
    Replies: 2
    Last Post: 06-29-2011, 01:54 PM
  2. Applet Wont Show Supposed Output, Please Help!!!!
    By bdmchamp in forum New To Java
    Replies: 7
    Last Post: 06-26-2011, 11:43 PM
  3. class that wont work out properly.
    By vampire-elf in forum New To Java
    Replies: 7
    Last Post: 09-07-2010, 01:39 AM
  4. Replies: 3
    Last Post: 10-26-2009, 11:42 AM
  5. whats wrong with this class declaration?
    By blossompark in forum New To Java
    Replies: 5
    Last Post: 11-30-2008, 02:18 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