Java – running applets in Web Applications
I want to run a simple applet in my web application using the HTML applet tag, but it gives an error
java. lang.ClassNotFoundException:MyApplet
Please send me sample application as far as possible
Solution
The problem is that the applet engine cannot find your myapplet class in the code base you defined
This may be because you have courses in the / Web - inf / classes directory This directory is protected by the servlet engine because it cannot be added from external resources (it can be an applet tag on a JSP / HTML page)
There are several ways to solve this problem The easiest way is to package your myapplet class as a jar file (let's call it myapplet. Jar) and save it in an accessible directory (that is, the JSP folder of the web application) For example, suppose you provide the following folders for your web application:
/MyWebApp/jsp /MyWebApp/applet /MyWebApp/WEB-INF
The client browser can access the contents of JSP and applet folders
Then, put myapplet Jar is saved in the applet folder, and the applet tag configuration is set like this (assuming that your Web context is mywebapp):
<applet codebase="/MyWebApp/applet" archive="myapplet.jar" code="MyApplet.class" width="600" height="500"> </applet>
Here you can find more information about the applet tag: http://docs.oracle.com/javase/tutorial/deployment/applet/index.html