Drools - Create a Drools Program



To create a basic Drools program, open Eclipse. Go to Fileb → New → Project.

Basic Drools Program

Select Drools Project. Give a suitable name for the project. For example, DroolsTest.

The next screen prompts you to select some files which you want in your first Drools project.

New Drools Project

Select the first two files. The first file is a .drl file (Drools Rule File) and the second file is a Java class for loading and executing the HelloWorld rule.

Click on Next → Finish.

Select Drools Runtime

Once you click on Finish, a <DroolsTest> project is created in your workspace. Open the Java class and then right-click and run as Java application. You would see the output as shown here −

Result

Next, we will discuss the terms frequently used in a Rule Engine.

Advertisements