Results 1 to 1 of 1
- 05-08-2012, 03:54 AM #1Member
- Join Date
- Nov 2008
- Rep Power
[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:
project website src web now.jsp <--- JSP File WEB-INF classes client <--- Package name FirstApplet.class <--- Applet lib
<%@ page import="java.util.Date" %> <html> <body> <% Date now = new Date(); out.println(now); %> <jsp:plugin type="applet" code="FirstApplet.class" width="400" height="400"> <jsp:fallback> <p>Unable to load applet</p> </jsp:fallback> </jsp:plugin> </body> </html>
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$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: 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$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native 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:
<jsp:plugin type="applet" code="client.FirstApplet.class" width="400" height="400"> <jsp:fallback> <p>Unable to load applet</p> </jsp:fallback> </jsp:plugin>
Last edited by Krooger; 05-08-2012 at 07:08 AM. Reason: Solved
- By bdmchamp in forum Java AppletsReplies: 2Last Post: 06-29-2011, 01:54 PM
- By bdmchamp in forum New To JavaReplies: 7Last Post: 06-26-2011, 11:43 PM
- By vampire-elf in forum New To JavaReplies: 7Last Post: 09-07-2010, 01:39 AM
- By nmvictor in forum JDBCReplies: 3Last Post: 10-26-2009, 12:42 PM
- By blossompark in forum New To JavaReplies: 5Last Post: 11-30-2008, 03:18 AM