Running a Java PAPI Program

The following procedures show you how to run from the command line a Java program that uses PAPI.

To run a Java PAPI program you need to have a Java SE Development Kit 5 (JDK 5) installed. You can download the JDK from Sun Developer Network. You may also use the JDK bundled with some installations of Oracle BPM Enterprise, which gets installed under <ORABPM_HOME>/jre/.

PAPI classes are contained in the fuegopapi-client.jar JAR file, which is distributed with Oracle BPM Enterprise under <ORABPM_HOME>/client/papi/lib/fuegopapi-client.jar.

  1. Open a command-line session.
  2. If you are not running the program from the same command-line session where you have compiled it, you need to add the PAPI library to the Java classpath by setting the environment variable CLASSPATH. The way of doing this depends on your operating system.
    • Linux:

      $export CLASSPATH="/OraBPMEnterpriseHome/client/papi/lib/fuegopapi-client.jar"
                                      
    • Windows:

      C:>set CLASSPATH="C:/OraBPMEnterpriseHome/client/papi/lib/fuegopapi-client.jar"
                                      
  3. Copy the file directory.xml to the location specified in your properties file or in your PAPI program. The file directory.xml resides in the directory <ORABPM_HOME>/conf. In the analyzed example the directory.xml file was copied to the directory from where the example is run. This location is specified in the following lines of code:
        Properties configuration = new Properties();
        //...
        configuration.setProperty(ProcessService.DIRECTORY_PROPERTIES_FILE, "directory.xml");
                        
  4. Run your PAPI program using the java command provided by the JDK:
    java MyFirstPapiApplication

    This step and step one can be merged into one by using the -classpath option when calling the java command:

    java -classpath "C:/OraBPMEnterpriseHome/client/papi/lib/fuegopapi-client.jar" MyFirstPAPIApplication
                        
When you run the program you see a list of the deployed processes and their instances. The following lines illustrate the generated output when executing this program connecting to an engine that has three instances sitting on the deployed process "Process":
                Process: /Process#Default-1.0
                -> /Process#Default-1.0/1/0
                -> /Process#Default-1.0/3/0
                -> /Process#Default-1.0/2/0