Community articleSetting Up Your Application
Added by IBM contributorIBM on May 6, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

As with any Java™ application, you must begin by importing the necessary classes and defining the program's classes.
  1. Create a new Java source file called
  2. Any program that calls methods from the API must import the following classes:
  3.    import com.PureEdge.DTK;
       import com.PureEdge.xfdl.FormNodeP;
       import com.PureEdge.xfdl.XFDL;
       import com.PureEdge.error.UWIException;
       import com.PureEdge.IFSSingleton;

    • You must place these lines before any class or interface definitions.
  4. Set up the rest of your application. This generally includes defining any classes and methods for your application as well as declaring and initializing any variables you may need. The following code sets up the Calculate Age application:
    • Create the public class CalculateAge and the main method for the class.
    •    public class CalculateAge

    • Declare a FormNodeP object called theForm to represent the form.
    •       private static FormNodeP theForm;

    • Create the program's main method.
    •       public static void main(String argv [])

    • Declare the program's variables.
    •       int birthYear;
            int birthMonth;
            int birthDay;

    • The program's main method essentially consists of a series of calls to other methods. The Form Library methods are called from the definition of these methods.
    •          try
                  birthYear = getBirthYear();
                  birthMonth = getBirthMonth();
                  birthDay = getBirthDay();

    • Free the memory in which the form was stored. For more information see Closing a Form .
    •             theForm.destroy();

    • Finally, perform exception handling.
    •          catch (Exception ex)
               /* Additional code removed */

Parent topic: Developing an application in Java