Before you begin developing CFX tags in Java, you must configure your Java development environment. Also, it might be helpful to review the examples in this topic before you create CFX tags.
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 for Windows in the cfx\java\distrib\examples subdirectory of the main installation directory. In UNIX systems, the files are located in the cfx/java/examples directory. The following table describes the example tags:
Example |
Action |
Demonstrates |
---|---|---|
HelloColdFusion |
Prints a personalized greeting. |
The minimal implementation required to create a CFX tag. |
ZipBrowser |
Retrieves the contents of a ZIP archive. |
How to generate a ColdFusion query and return it to the calling page. |
ServerDateTime |
Retrieves the date and time from a network server. |
Attribute validation, using numeric attributes, and setting variables within the calling page. |
OutputQuery |
Returns a ColdFusion query in an HTML table. |
How to handle a ColdFusion query as input, throw exceptions, and generate dynamic output. |
HelloWorldGraphic |
Generates a "Hello World!" graphic in JPEG format. |
How to dynamically create and return graphics from a Java CFX tag. |
You can use a wide range of Java development environments, including the Java Development Kit (JDK) from Sun, to build Java CFX tags. You can download the JDK from Sun http://java.sun.com/j2se.
Adobe recommends that you use one of the commercial Java IDEs, so you have an integrated environment for development, debugging, and project management.
To configure your development environment to build Java CFX tags, you must ensure that the supporting classes are visible to your Java compiler. These classes are located in the cfx.jar archive, located in one of the following directories:
Server configuration: cf_root/wwwroot/WEB-INF/lib
J2EE configuration: cf_webapp_root/WEB-INF/lib
Consult your Java development tool documentation to determine how to configure the compiler classpath for your particular environment.
The cfx.jar archive contains the classes in the com.allaire.cfx package, which are required for developing and deploying Java CFX tags.
When you create new Java CFX tags, you should compile them into the WEB-INF/classes directory. Doing this simplifies your development, debugging, and testing processes.
After you finish with development and testing, you can deploy your Java CFX tag anywhere on the classpath visible to ColdFusion.
Use the ColdFusion Administrator > Server Settings > JVM and Java Settings page to customize your Java development environment by customizing the classpath and Java system properties, or by specifying an alternate JVM. For more information, see the ColdFusion Administrator online Help.