This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Applets and the fly likes Applet not getting initialized Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet not getting initialized" Watch "Applet not getting initialized" New topic
Author

Applet not getting initialized

Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
I have a jsp page (myPage.jsp) in

D:\Tomcat\webapps\jsp-examples

here is the code of this jsp

and here is my Java applet (MyApplet.java) in D:\Tomcat\webapps\jsp-examples\WEB-INF\classes\sample


When I call my JSP page, I get the message : Loading Java applet failed.

If i right click on it, the message in the console is

load: class sample.MyApplet not found.

java.lang.ClassNotFoundException: sample.MyApplet

at sun.applet.AppletClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.applet.AppletClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.applet.AppletClassLoader.loadCode(Unknown Source)

at sun.applet.AppletPanel.createApplet(Unknown Source)

at sun.plugin.AppletViewer.createApplet(Unknown Source)

at sun.applet.AppletPanel.runLoader(Unknown Source)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: java.io.IOException: open HTTP connection failed.

at sun.applet.AppletClassLoader.getBytes(Unknown Source)

at sun.applet.AppletClassLoader.access$100(Unknown Source)

at sun.applet.AppletClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

... 10 more


Can someone please tell me how to resolve this.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
The servlet container will not serve anything out of WEB-INF, so the browser can't get at the class files. Put the sample directory into the jsp-examples directory, then it should work.


Ping & DNS - my free Android networking tools app
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
Thanks a lot.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Applet not getting initialized
 
Similar Threads
Applet not inited problems
java: ClassNotFoundException
ClassNotFoundException
Where dose JSException come from?
Argh....all I want to do is load this applet..