SAP Knowledge Base Article - Public

1803967 - How to make a Java UFL available in Crystal Reports?

Symptom

  • Functions added by a Java UFL not available.
  • Java UFL functions are not visible in the Formula Editor in Crystal Reports.
  • How to make a Java UFL functions available in Crystal Reports?

Environment

  • SAP Crystal Reports 2020
  • SAP Crystal Reports 2025

Reproducing the Issue

  1. Create a Java UFL
  2. Start Crystal Reports
  3. Create a new report.
  4. Create a new Formula.
  5. In the Formula Editor, under Functions, it does not show the new functions that are supposed to be added by the Java UFL. 

Cause

  • Crystal Reports is not configured to load the Java UFL.

Resolution

To load the functions added by the Java UFL in Crystal Reports:

  1. Copy the Java UFL jar file in the following folder:

       C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib
      
     
  2. Create the Environment Variable: JAVA_HOME

    2.1  Create a MS Windows System Environment Variable: JAVA_HOME
    2.2  Set the Environment Variable JAVA_HOME to the following path:

    C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win64_x64\sapjvm
     
          
  3. Create the Environment Variable: CLASSPATH
      
    3.1  Create a MS Windows System Environment Variable: CLASSPATH   
    3.2  Add all of the following jar file to the CLASSPATH:

    C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib\external\commons-collections-3.2.2.jar;   
    C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib\external\commons-configuration-1.10.jar; 
    C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib\external\commons-lang-2.3.jar;
    C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib\external\commons-logging.jar;
    C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib\external\icu4j.jar;
    C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib\external\log4j.jar;
    C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib\CrystalFormulas.jar;
    C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib\CrystalReportingCommon.jar;
    C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib\u211java.jar;      
     
           
  4. Add the Java UFL jar file to the CLASSPATH

    For example, if the Java UFL jar file name is: MyJavaUFL.jar
    Then add the following path to the CLASSPATH environment variable

    C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib\MyJavaUFL.jar

      
  5. Copy the following jar files found in the Attachment section of this SAP Knowledge Base under the name: Required_jar_files.zip
      
         - commons-configuration-1.10.jar
         - commons-lang-2.3.jar
         - log4j.jar

    To the following folder:

         C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib\external 
      

  6. In the Microsoft Registry Editor, add the Java registry keys:
      
    6.1 Start the Microsoft Registry Editor (regedit)   
    6.2 Navigate to the path:

          HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Suite XI 4.0\Crystal Reports
       
    6.3 Add a String Value          : JREPath
    6.4 Set the value to the JDK : 

    C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win64_x64\sapjvm\bin\server\jvm.dll

    6.5 Add a String Value           : JavaUFLLogging
    6.6 Set the value to the JDK : 

            C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib
      

  7. Add to the CRConfig.xml the Java UFL
      
    7.1 Edit CRConfig.xml, located in the following folder: 

          C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\java

    7.2 Add the class name between the tags: 

              <ExternalFunctionLibraryClassNames> 
                    <classname> 
                           <ADD THE CLASS NAME HERE>
                    </classname>
               </ExternalFunctionLibraryClassNames>

      7.3 Also add in Classpath tag the Java UFL jar file name and path.

              <Classpath>
                   …
                   C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\java\lib\<JAVA UFL JAR FILE NAME>
                   …
               </Classpath>

  8. In Crystal Reports, change the UFL Support option to: "Java UFL's Only"
      
      8.1  Start Crystal Reports 
      8.2  Under the menu “File”, select “Options”
      8.3  In “Options” under the tab “Formula Editor”, select for UFL Support: “Java UFL’s Only”
      8.4  Click “OK”
      
  9. Restarted Crystal Reports.
      
  10. Create, or open a report, and create a formula. The Java UFL function(s) will show under the Additional Functions in the Formula Editor.

Keywords

KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

SAP Crystal Reports 2020 ; SAP Crystal Reports 2025

Attachments

Crystal Reports XI - Java User-Defined Function Libraries (UFL)_0_.pdf
Required_jar_files.zip