Skip to main content

Running the Java Custom Function Example


These files can be used to create a WindwardCustomFunctions.jar file containing your own custom functions, to be used with the Windward Java engine, version or newer.

The CustomFunctionExample.ipr is a project file for IntelliJ, a Java IDE.

Important notes

  1. Compile using Java version 1.7 or earlier.
  2. Do not change the version of the JAR created using this code.
  3. To use, replace the assembly of the same (WindwardCustomFunctions.jar) name where you installed the Java engine.


Please note - we are currently in the process of updating all video content.



Creating Custom Functions

  1. Open Catapult. (Found under Start -> All Programs -> Windward Studios -> Windward Reports Java Engine -> Java Engine Help Launcher)
  2. In Catapult, click the Java button.
    Java Catapult Main Menu.PNG
  3. Under Java Demos, click the Specialized button.

        Java Catapult Specialized.PNG

  1. Use the scroll bar to scroll to the right and click the Custom Functions button.

        Java Catapult Custom Functions.PNG

In the file, you can write your own custom functions to be used with the Java Engine. We are provided with five functions here, Pi, square root, and multiply all, add total, get total. In the following steps, we will add a function E() that returns the value of Euler’s constant, e.

  1. Change the number of functions to 6.
    Java custom function change number of.PNG
  2. Paste the following code in the second section (below multiply all) to add the function’s information:
            functionName[3] = "E";
            functionFullName[3] = "E()";
            functionDescription[3] = "Returns the value of e, 2.71828182845904, accurate to 15 digits.";
            functionNumberOfArgument[3] = new Integer(0);
            functionArgumentName[3] = null;
            functionArgumentDescription[3] = null;
            functionArgumentType[3] = null;
  3. Verify that the indentation is correct; the resulting code should look like this:
    Java Custom Function E.PNG
  4. Paste the following code in the fifth section (below get total) to add the function itself:
         public static Object E() {
               return new Double(2.71828182845904);
  5. Verify that the indentation is correct; the resulting code should look like this:
    Java Method for E.PNG
  6. Click Build, Rebuild Project.

Installing WindwardCustomFunctions.jar for use with the Java Engine

  1. In Catapult click click the Custom Functions button to open the CustomFunction folder.  By default, this is located in C:\Users\<username>\Documents\Windward Java Engine Samples\Java\Specialized\CustomFunction.
  2. Navigate to out, artifacts, WindwardCustomFunctions.
    Java custom functions source folder.PNG
  3. Copy the file WindwardCustomFunctions.jar
  4. Navigate to the install directory of the Java Engine.
  5. Open the jars folder.
  6. Delete the current WindwardCustomFunctions.jar file.

Paste your new file in its place.

  • Was this article helpful?