11.4. Using Java applet in ColdFusion
We used to manage Java applet in ColdFusion 9 on Windows2008 R2 x64 and IIS 7.
We placed the component ActiveQueryBuilder.jar and the applet LiveDemoApplet.jar into the \test\ folder of default IIS site (full path is C:\inetpub\wwwroot\test\).
Below are the steps to get it working:
1. Open the ColdFusion Admininstrator console.
2. Go to Extensions / Java Applets. Here you have to register the applet before using it on a page.
See the screenshot for working parameters.
- "Applet Name" is identificator you will use to refer the applet from <cfapplet> tag.
- "Code" is the classpath of main applet class inside of JAR file without ".class" in the end.
- "Code Base" is the path to jar file relative to the site root directory. Both "/" symbols are required.
- "Archive" is the name of the applet JAR file.
Other params are optional, but you may specify them here to omit them later in the <cfapplet> tag.
3. Create a sample "demo.cfm" file in the /test/ folder. It's only content is:
<cfapplet appletSource="AQB" name="applet1_var">
The "appletSource" attribute value is the ID that you entered during the applet registration and "name" is variable you can use to access the applet from the page code.
That's all. You may type the valid URL in your browser, to run your applet.
Please note that you should to sign the applet's jar file with developer or commercial certificate, otherwise the browser will fail to load the applet becuase of Java machine security settings.