How to use Java applet in ColdFusion?
We used to managea 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 the default IIS site (full path is C:\inetpub\wwwroot\test\).
Below are the steps to get it working:
Open the ColdFusion Administrator console.
Go to Extensions / Java Applets. Here you have to register the applet before using it on a page.See the screenshot for working parameters.There are:
Other params are optional, but you may specify them here to omit them later in the <cfapplet> tag.
- "Applet Name" is an identificator you will use to refer the applet from <cfapplet> tag.
- "Code" is a classpath of the main applet class inside of the JAR file without ".class" in the end.
- "Code Base" is a path to jar file relative to the site root directory. Both "/" symbols are required.
- "Archive" is the name of the applet JAR file.
Create a sample "demo.cfm" file in the /test/ folder. Its 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 a 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 sign the applet's jar file with the developer or commercial certificate. Otherwise, the browser will fail to load the applet because of Java machine security settings.