This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Applets and the fly likes Error in loading Applet from JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Error in loading Applet from JSP" Watch "Error in loading Applet from JSP" New topic
Author

Error in loading Applet from JSP

Neeba Rebbaca
Ranch Hand

Joined: Oct 21, 2008
Posts: 136
i tried to launch an applet from a jsp file.But i'm getting some error.Can anyone help me in solving the problem..



thanks all!!!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Post the applet tag from the HTML page and the directory layout of the files on the server.


Ping & DNS - updated with new look and Ping home screen widget
Neeba Rebbaca
Ranch Hand

Joined: Oct 21, 2008
Posts: 136
This is my directory structure:




My jsp code:

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Nothing that's inside of "WEB-INF" will be served to the client. You need to move all classes and jar files used by the applet into a publicly accessible directory. The best choice is probably the same directory the JSP file is in.
Neeba Rebbaca
Ranch Hand

Joined: Oct 21, 2008
Posts: 136
So , i have to place the package containing applet class files and its supporting jar file in the place where jsp file is ?
Neeba Rebbaca
Ranch Hand

Joined: Oct 21, 2008
Posts: 136
I have placed class files where the jsp files are, but still i'm getting the same error

load: class NewApplet.class not found.
java.lang.ClassNotFoundException: NewApplet.class
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

Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1398
    
    6

Make sure the applet class is a public class.


Swastik
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
load: class NewApplet.class not found.

Is the class name really "NewApplet"? In your first post you used "NewJApplet".
Neeba Rebbaca
Ranch Hand

Joined: Oct 21, 2008
Posts: 136
Its NewApplet.In my first post in made a mistake.Now i corrected it.Even then i'm getting the same error.

it contains some error like :


why does it comes?due to any settings problem?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Just to make sure, you have this:

as the JSP page, and the file "NewApplet.class" is in the exact same directory as the JSP page?

Can you download the class file manually by pasting its URL in the browser?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error in loading Applet from JSP
 
Similar Threads
Applet not getting initialized
class not found error
Problem running an applet
java.io.IOException: open HTTP connection failed:
Calling an applet in a JSP page