While implementing CFX tags in Java is easy, you should consider the information in this section before you begin developing them.
Before you begin developing a CFX tag in Java, you might want to study sample CFX tags. You can find the Java source files for the examples on Windows in the cfx\java\distrib\examples subdirectory of the main installation directory. On UNIX systems, the files are located in the cfx/java/examples directory. The example tags are as follows:
HelloColdFusion
Prints a personalized greeting. Demonstrates the minimal implementation required to create a CFX.
ZipBrowser
Retrieves the contents of a zip archive. Demonstrates how to generate a ColdFusion query and return it to the calling page.ServerDateTime
Retrieves the date and time from a network server. Demonstrates attribute validation, using numeric attributes, and setting variables within the calling page.OutputQuery
Outputs a ColdFusion query in an HTML table. Demonstrates how to handle a ColdFusion query as input, throw exceptions, and generate dynamic output.HelloWorldGraphic
Generates a "Hello World!" graphic in JPEG format. Demonstrates how to dynamically create and return graphics from a Java CFX.You can use a wide range of Java development environments, including the Java Development Kit (JDK) from Sun to build Java CFXs. You can download the JDK from Sun http://java.sun.com/j2se.
Although you can use the basic JDK, the recommended approach is to use one of the commercial Java IDEs that provide an integrated environment for development, debugging, project management, and access to documentation.
To configure your development environment to build Java CFXs, you must ensure that the supporting classes are visible to your Java compiler. These classes are located in the cfx.jar archive, located in the Java/classes subdirectory of your ColdFusion installation directory. Consult your Java development tool's documentation to determine how to configure the compiler class path for your particular environment.
The classes
directory created by the ColdFusion setup program serves two purposes:
com.allaire.cfx
package located in the cfx.jar
archive.
When you create new Java CFXs, you should develop and deploy them in the classes
directory. Following this guideline will dramatically simplify your development, debugging, and testing processes.
Once you are finished with development and testing, you can then deploy your Java CFX anywhere on the class path visible to the ColdFusion embedded JVM. See "Customizing and Configuring Java" for more details on customizing the class path.
You use the JVM and Java Settings page on the ColdFusion Administrator Server tab to customize your Java development environment, such as by customizing the class path and Java system properties, or specifying an alternate Java Virtual Machine (JVM).