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/runExamples.sh
    2. Windows: /examples/runExamples.bat

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

9 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hi,
    Sudoku example works fine. For the pacman example, under windows sp3 and jdk 1.6.0.24, 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(EventQueue.java:1026)
    at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1326)
    at org.drools.examples.pacman.PacmanGui.init(PacmanGui.java:72)
    at org.drools.examples.pacman.PacmanExample.initGui(PacmanExample.java:173)
    at org.drools.examples.pacman.PacmanExample.main(PacmanExample.java:42)
    at org.drools.examples.DroolsExamplesApp$3.actionPerformed(DroolsExamplesApp.java:77)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6289)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
    at java.awt.Component.processEvent(Component.java:6054)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4652)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4482)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2478)
    at java.awt.Component.dispatchEvent(Component.java:4482)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
    at java.awt.EventQueue.access$000(EventQueue.java:85)
    at java.awt.EventQueue$1.run(EventQueue.java:603)
    at java.awt.EventQueue$1.run(EventQueue.java:601)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
    at java.awt.EventQueue$2.run(EventQueue.java:617)
    at java.awt.EventQueue$2.run(EventQueue.java:615)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    count : 0

    ReplyDelete
  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.

    ReplyDelete
  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 ./runExamples.sh
    - 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

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

    ReplyDelete
  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).

    ReplyDelete
  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

    ReplyDelete
  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.

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

    ReplyDelete