Invoking JavaScript from within an Applet

If you had never known of this capability, chances are you would port most JavaScript codes to Java or worse, resort to some exotic coding. Otherwise, you would just reuse the existing codes.

Software applications used:

  1. Eclipse 3.4.2
  2. JDK1.6.0_21
  3. plugin.jar (e.i., C:\Program Files\Java\jdk1.6.0_21\jre\lib\plugin.jar)

The Applet

The HTML file

When building the Applet, make sure that plugin.jar is in the class path. Once built successfully, put the class and HTML files together in the same folder and open the page using a web browser.


Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert