This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 157
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: 41599
    
  55
Post the applet tag from the HTML page and the directory layout of the files on the server.


Ping & DNS - my free Android networking tools app
Neeba Rebbaca
Ranch Hand

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




My jsp code:

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
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: 157
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: 157
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: 1473
    
    6

Make sure the applet class is a public class.


Swastik
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
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: 157
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: 41599
    
  55
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?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error in loading Applet from JSP