Adding Java applets to a Web project

To add Java™ applets to a Web page, you must add them to a Web project so the Web pages can access the applets.
Prerequisite: Create a Web project.
To create the applet and add it to a Web project:
  1. Create a Java project to hold the Java applet source and any related files.
  2. Create a JApplet class, as follows:
    1. From any project, select File > New > Other > Java > Visual Class.
    2. In the Style list, expand Swing and select Applet.
    3. Set any other applicable attributes and click Finish.
  3. Use the Visual Editor for Java to create the applet content, and debug it using the Run as JavaBean option.
  4. If there are more than class files only (the simplest case), including image files, and any other files specified in the class files, you can create a JAR to package the resources related to the applet.
  5. Create a folder in the Web project under the Web content folder (but not under the WEB-INF folder) to contain your Java applet class and JAR files.
  6. Import the applicable applet and JAR binaries into the designated Web project folder.
  7. Insert Java applets as described in Inserting applets.

Once you have inserted JApplets in your Web pages, you should run the pages through the HTML Converter. The converter will then automatically convert the <APPLET> tags in your Web pages to tags that the Java plug-in recognizes.

Related concepts
Java applets in Web pages
Related tasks
Adding scripts, controls, and effects to Web pages
Inserting applets
Adding server-side includes to Web pages

Feedback