Thanks, and this should get me started.
I find that most of the documentation is eclipse-centric, and probably it would help for the newbies like me, if the documentation also includes more material on usage with other IDEs.

Thanks again

2009/5/3 Wolfgang Laun <>
This is what you might do:

        KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase();
        KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kBuilder.add( ResourceFactory.newFileResource( "Movie.drl" ),
                      ResourceType.DRL );
        if( kBuilder.hasErrors() ){
            for( KnowledgeBuilderError err: kBuilder.getErrors() ){
                System.out.println( err.toString() );
            throw new IllegalStateException( "DRL errors" );

        OutputStream os = new FileOutputStream( "Movie.pkg" );
        ObjectOutputStream oos = new ObjectOutputStream( os );

        oos.writeObject( kBuilder.getKnowledgePackages() );
// And now, from the file containing the binary knowlewdge packages:

        InputStream is = new FileInputStream( "Movie.pkg" );
        ObjectInputStream ois = new ObjectInputStream( is );
        Collection<KnowledgePackage> kpkgs = (Collection<KnowledgePackage>) ois.readObject();

        kBase.addKnowledgePackages( kpkgs );


2009/5/2 Perumaal Krishnaraj <>
Hello Everybody,
I'm a newbie to Drools, so please excuse me, if question is very fundamental.
I'm not using drools with eclipse or brms.
I would like to convert the drl file which I had created using a text editor to the binary form ie. in pkg format (serialized), which can be used im my Java application.

Is there a tool, or a code snippet which gives me an idea as to how this is done.


rules-users mailing list

rules-users mailing list