Before You Begin Developing CFX Tags in Java

Because the methods and syntax are similar, if you are familiar with creating CFXs using C++ you will be productive creating CFXs in Java almost immediately. Even if you have never used the C++ based API, you will find that the Java implementation is extremely easy to learn and work with.

Sample Java CFXs

Before you begin developing a CFX tag in Java, you may want to study sample CFX tags. The Java source files for the examples can be found in the examples subdirectory of the main installation directory. The example tags are:

Setting Up Your Development Environment to Develop CFXs in Java

You can use a wide range of Java development environments to build Java CFXs, including the Java Development Kit which you can download from Sun at

http://www.javasoft.com/products/jdk/1.2/index.html

Although you can use just the basic JDK, it is highly recommended that you use one of the commercial Java IDEs that provide an integrated environment for development, debugging, project management, and access to documentation. If you don't already have a Java development environment, we recommend that you try Symantec Visual Café, for which a 30 day free trial is available at

http://www.symantec.com/domain/cafe/vcafe30.html

Configuring the Class Path

To configure your development environment to build Java CFXs, you need to make sure that the supporting classes are visible to your Java compiler. These classes are located in the classes\cfx.jar archive. The full path is <coldfusioninstalldir>/Java/classes 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:

  1. It contains the supporting classes required for developing and deploying Java CFXs. This is the com.allaire.cfx package located in the cfx.jar archive.
  2. It supports a feature that allows Java CFXs located within it to be reloaded every time they are changed. Although this is not the default behavior for other Java classes, it is very useful during an iterative development and testing cycle.

Allaire strongly recommends that when you create new Java CFXs, you develop and deploy them within 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 "Java Customization and Configuration" for more details on customizing the class path.