Reputation: 110
I have made an applet in eclipse, and I can run it succesfully with right click on the java file and run as -> Java Applet
But I want to add that applet into a xhtml file, so added the applet tag in the index.xhtml file but when I deploy the index.xhtml in the browser I just get an error saying that the MyApplet.class cannot be found
<applet code="com.project.helper.MyApplet.class" width="500" height="500">
I have the files organized in this way:
Image with the body of the files
Upvotes: 1
Views: 195
Reputation: 28707
You must define the archive attribute of the applet xhtml line, which is the location of your applet's jar file from which the class attribute should be loaded.
<applet code="com.project.helper.MyApplet.class" archive="MyApplet.jar" width="500" height="500">
Upvotes: 1