Saturday, April 23, 2011

Try a Drools example in less than a minute

Now that Drools 5.2.0.M2 is released, it's very easy to try an example yourself:
  1. Download a download zip (this may take more than a minute):
    1. Drools
    2. Drools & jBPM integration
    3. Drools Planner
  2. Unzip it
  3. Double click on the runExamples script:
    1. Linux/Mac: /examples/
    2. Windows: /examples/runExamples.bat

And you'll see one of these 3 windows:
Just chose on an example to run it.


  1. This comment has been removed by the author.

  2. Hi,
    Sudoku example works fine. For the pacman example, under windows sp3 and jdk, there is exception :

    Cell 11:10 : CellType WALL
    Exception in thread "AWT-EventQueue-0" java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread
    at java.awt.EventQueue.invokeAndWait(
    at javax.swing.SwingUtilities.invokeAndWait(
    at org.drools.examples.pacman.PacmanGui.init(
    at org.drools.examples.pacman.PacmanExample.initGui(
    at org.drools.examples.pacman.PacmanExample.main(
    at org.drools.examples.DroolsExamplesApp$3.actionPerformed(
    at javax.swing.AbstractButton.fireActionPerformed(
    at javax.swing.AbstractButton$Handler.actionPerformed(
    at javax.swing.DefaultButtonModel.fireActionPerformed(
    at javax.swing.DefaultButtonModel.setPressed(
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
    at java.awt.Component.processMouseEvent(
    at javax.swing.JComponent.processMouseEvent(
    at java.awt.Component.processEvent(
    at java.awt.Container.processEvent(
    at java.awt.Component.dispatchEventImpl(
    at java.awt.Container.dispatchEventImpl(
    at java.awt.Component.dispatchEvent(
    at java.awt.LightweightDispatcher.retargetMouseEvent(
    at java.awt.LightweightDispatcher.processMouseEvent(
    at java.awt.LightweightDispatcher.dispatchEvent(
    at java.awt.Container.dispatchEventImpl(
    at java.awt.Window.dispatchEventImpl(
    at java.awt.Component.dispatchEvent(
    at java.awt.EventQueue.dispatchEventImpl(
    at java.awt.EventQueue.access$000(
    at java.awt.EventQueue$
    at java.awt.EventQueue$
    at Method)
    at java.awt.EventQueue$
    at java.awt.EventQueue$
    at Method)
    at java.awt.EventQueue.dispatchEvent(
    at java.awt.EventDispatchThread.pumpOneEventForFilters(
    at java.awt.EventDispatchThread.pumpEventsForFilter(
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(
    at java.awt.EventDispatchThread.pumpEvents(
    at java.awt.EventDispatchThread.pumpEvents(
    count : 0

  3. I though I fixed that EDT problem in Pacman. I 'll fix it for CR1. Maybe the change didn't make the M2 branch.
    Thank you for reporting this problem.

  4. Hi,

    I tried the examples on mac OS X (snow leopard fresh install). A few notes that may assist:

    - The script opens in TextEdit from the GUI, but can be launched via the terminal as ./
    - The Pacman example also fails on OS X (not just windows)
    - The runExamples script complains about "/bin/java - no such file or directory". Entering "export JAVA_HOME=/usr" doesnt fully correct the problem, but it forces the system-provided java to be used and the examples run.

    regards Nick

  5. I've fixed the PacmanExample for CR1:
    Note that the Pacman example isn't really visual (unlike sudoku and petstore).

  6. @Nick: What do you mean with "doesn't fully correct the problem"?

    Usually a java developer has JAVA_HOME set to a JDK path, but one could argue that we shouldn't rely on that. Out of curiosity, what does "java -version" give you on your machine? Maybe we can script something like if JAVA_HOME doesn't exist, try just "java" but without "-server" (which the planner examples really like a lot).

  7. Hi Geoffrey,

    On my Core 2 Duo Mac (64bit), "java -version" provides:

    java version "1.6.0_24"
    Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
    Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)

    Running without -server in the script still returns the same result. The text in the script file providing the example of export JAVA_HOME=/usr/lib/jvm/java-6-sun wont work on OS X either. The user should enter "export JAVA_HOME=/Library/Java/Home" which is a symbolic link to the current JDK (updated automatically by apple). Perhaps this could be mentioned in the script?

    Whatever removes barriers for those trying Drools for the first time is a good thing.

    Cheers, Nick

  8. Thanks Nick: I 've added the mac export example line too.
    I might take a look at falling back on "java" without "-server" mode (which is only available in the jdk, not the jre) if JAVA_HOME doesn't point to a jdk.

  9. unable to unzip the folders!.do they require any authentication