定义一个ActionHandler:
package com.test;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
public class MyAction implements ActionHandler
{
 private static final long serialVersionUID = 1L;
 private String message;
 public String getMessage()
 {
  return message;
 }
 public void setMessage(String message)
 {
  this.message = message;
 }
 public void execute(ExecutionContext executionContext) throws Exception
 {
  System.out.println(message);
 }
}

定义一个流程文件:
  xmlns="urn:jbpm.org:jpdl-3.1"
  name="simple">
  
     
        
            Going to the first state!
        

     

  

  
     
        
            About to finish!
        

     

  

  
定义流程驱动类:
package com.test;
import java.io.IOException;
import java.io.InputStream;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
public class Main
{
 public static void main(String[] args) throws IOException
 {
  InputStream stream = Main.class.getResourceAsStream("processdefinition.xml");
  ProcessDefinition processDefinition = ProcessDefinition
    .parseXmlInputStream(stream);
  stream.close();
  ProcessInstance instance = new ProcessInstance(processDefinition);
  while (!instance.hasEnded())
  {
   instance.signal();
  }
 }
}

将jbpm***.jar、commons-logging**.jar和dom4j.jar三个包加入classpath就可以了。
执行结果:
Going to the first state!
About to finish!