Meaningless Drivel is fun!*
The moose likes Applets and the fly likes insertin g a class in an applet 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 "insertin g a class in an applet" Watch "insertin g a class in an applet" New topic
Author

insertin g a class in an applet

Dura Hurtado
Ranch Hand

Joined: Feb 16, 2011
Posts: 120
Hi , I am trying to in a webcamera in an applet then I use the next code:

<applet code="webcam.class" codebase="../bean/" archive="webcam.jar" width="320" height="240">

I have revised a lotrs of times and the path doesn´t give me more that the next error:

cargar: clase webcam.class no encontrada.
java.lang.ClassNotFoundException: webcam.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.P

¿Any clue?

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Try removing ".class" from the code attribute - the attribute takes a class name, not a file name.

webcam.class is in the top level of the webcam.jar file? which itself is in a parallel directory called "bean" to the directory where the HTML file resides?


Ping & DNS - updated with new look and Ping home screen widget
Dura Hurtado
Ranch Hand

Joined: Feb 16, 2011
Posts: 120
The webcam.class is in the bean package which is parallel to the WebPages folder where the .xhtml is in.

I am using Glassfish and Netbeans. Also the .jar is in the path of the project and in the path of WebPages folder.

I have tried all posibilities I have found, and it never finds it.

¿Any idea?

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
If the class is in a package then the code attribute needs to reflect that - it takes the fully qualified class name.

I'm not quite sure what the directory layout of all your files is; maybe you can make that a bit clearer. I advise not to use an IDE to run applets; they cause the applet to work differently than it would in reality.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: insertin g a class in an applet
 
Similar Threads
Problem with an applet
My applet is not being seen in its jar anymore. Please help!
Applets not loading in JRE verion >= JRE 1.6.0_10 and FF3
ClassDefNotFoundError - wrong name
Access HTTPS url in Applet