JBPM5 Setting process variables at startup

This tutorial has been written for an old version of jBPM which is now deprecated.

If you want to get started quickly with jBPM, we recommend the following quickstarts:

You can provide input parameters to your process much the same way you did with jBPM3.

For example, here’s how to set the initial value for the “money” process variable:

KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession =

Map<String, Object> inputParams =

         new HashMap<String, Object>();
inputParams.put("money", new Long(15));
// start a new process instance
ProcessInstance process =


Remember, that process variables need to be defined into your BPMN 2.0 process file. In this example:

<itemDefinition id="_moneyItem" structureRef="Integer" />

  <process processType="Private" isExecutable="true" id="com.sample.bpmn.task" name="Sample Task" >

    <!-- process variables -->
    <property id="money" itemSubjectRef="_moneyItem"/>

    . . . . .


Hint: if you are using Eclipse jBPM plugin, then you can define a variable by simply pointing to any place on your BPMN 2.0 diagram (where there are no nodes) and in the “Properties” Tab insert your variable:

jbpm5 process variables