I'd have thought a FileResource would have been better than a ClassPathResource given your example.

Unless c:\savedRules\ is obviously on your classpath?

On 14 February 2011 11:21, stefano82 <illidan.guru@gmail.com> wrote:

hello,
i devloped a custom rule editor able to create drl file and save them in
file system under a given directory. (e.g. c:\savedRules\rule.drl).
The problem is that once the rule is saved i need to run it with drools
engine.
In my class i try to load rule in this way:

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("c:\savedRules\rule.drl"),
ResourceType.DRL);

but its doesn't work. the exception is "rule.drl cannot be opened because it
does not exist" but it actually exists....

What am I doing wrong? there is another way to load rules directly from file
sistem?

thanks in advice.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-load-drl-rule-file-from-file-system-tp2491856p2491856.html
Sent from the Drools - Dev mailing list archive at Nabble.com.
_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev