Running an Applet

See Also

If you create an applet as part of a Java WebStart-enabled project, you can run the applet by running the project.

If your applet is not part of a WebStart-enabled project, the applet is not run as part of the project.

To run an applet invidually:

  1. Right-click an applet class in the Projects window or Files window.
  2. Select Run File from the pop-up menu.

    The myappletclass.html launcher file, with the applet embedded, is created in the build folder and launched in the Applet Viewer.

  3. To run or debug an applet with the parameters, you need to edit the launcher, copy it from the build folder to the package where the applet class lives in the src folder. Make sure that the myappletclass.html launcher file has the same name as the applet class. Now edit the myappletclass.html launcher file as needed. When you build the project, the myappletclass.html launcher file is copied from the src folder to the build folder.

  4. To exclude the myappletclass.html launcher file from the JAR file, right-click the project, choosing Properties, clicking Packaging, and adding an expression to exclude them.
    tip  An HTML file is created by the IDE when you run or debug an applet. When you copy it to your src folder for editing, it will automatically be included in the JAR file when you build the project.
  5. Package the applet in the web application.
  6. Define the applet in a JSP file.
  7. Run the JSP file that contains the applet or deploy the web application that contains the JSP file.

Debugging an Applet

Applets run in the virtual machine of the IDE's default web browser. The IDE uses a different virtual machine and therefore applets are not included in a web application's debug session. Therefore, debug the applet launcher file as described in step 2 above.

See Also
Creating an Applet
Setting Permissions for an Applet

Legal Notices