Geoffrey,<div><br></div><div>Thank you, that worked! </div><div><br></div><div>I was wondering now if I can achieve the same with the drools rule file. The method below wouldn&#39;t work because it&#39;s not me who load the file (I think it&#39;s at AbstractSolverConfig.buildRuleBase, which seems to use getResourceAsStream too).</div>
<div><br></div><div><br><div class="gmail_quote">2011/10/11 Geoffrey De Smet <span dir="ltr">&lt;<a href="mailto:ge0ffrey.spam@gmail.com">ge0ffrey.spam@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>

  
    
  
  <div text="#000000" bgcolor="#ffffff">
    Hi Guilharme,<br>
    <br>
    There&#39;s an overloaded method called configure(InputStream in) and
    configure(Reader reader)  too, use either of those instead:<br>
    <br>
    try {<br>
      InputStream in = new FileInputStream(&quot;<font face="&#39;courier new&#39;, monospace">/path/to/xml/file/SolverConf.xml&quot;);</font><br>
      configurer.configure(in);<br>
    } finally {<br>
      IOUtils.closeSilently(in);<br>
    }<br>
    <br>
    Op 11-10-11 15:01, Guilherme Kunigami schreef:
    <blockquote type="cite"><div><div></div><div class="h5">
      <div>Hi,</div>
      <div><br>
      </div>
      <div><font face="arial, helvetica,
          sans-serif">I&#39;m trying to load a configuration file (namely
          SolverConf.xml) into XmlSolver with the code below:</font></div>
      <div>
        <span style="font-family:&#39;courier new&#39;,monospace"><br>
        </span></div>
      <div>
        <div><font face="&#39;courier new&#39;,
            monospace">XmlSolverConfigurer configurer = new
            XmlSolverConfigurer();</font></div>
        <div><font face="&#39;courier new&#39;,
            monospace">configurer.configure(SOLVER_CONFIG);</font></div>
        <div><font face="&#39;courier new&#39;,
            monospace">Solver solver = configurer.buildSolver();</font></div>
      </div>
      <div><font face="&#39;courier new&#39;,
          monospace"><br>
        </font></div>
      <div><font face="arial, helvetica,
          sans-serif">If I bundle SolverConf.xml file with the
          application .jar file, then using </font><font face="&#39;courier new&#39;, monospace">SOLVER_CONFIG</font><font face="arial, helvetica, sans-serif">
          as </font><font face="&#39;courier new&#39;,
          monospace">/path/to/xml/file/SolverConf.xml</font><font face="arial, helvetica, sans-serif">
          works fine.</font></div>
      <div><span style="font-family:&#39;courier new&#39;,monospace"><br>
        </span></div>
      <div><font face="arial, helvetica,
          sans-serif">But I want to use SolverConf.xml outside the .jar,
          so I can easiliy edit it, but I don&#39;t know what path should I
          pass to it.</font></div>
      <div><font face="arial, helvetica,
          sans-serif"><br>
        </font></div>
      <div><font face="arial, helvetica,
          sans-serif">I know it&#39;s a Java related question, but I was
          wondering if anyone had a similar problem when configuring
          drools planner. (I&#39;ve asked on stackoverflow, but none of the
          answers worked for me: <a href="http://stackoverflow.com/questions/7718807/can-getresourceasstream-find-files-outside-the-jar-file" target="_blank">http://stackoverflow.com/questions/7718807/can-getresourceasstream-find-files-outside-the-jar-file</a>)</font></div>

      <div><font face="arial, helvetica,
          sans-serif"><br>
        </font></div>
      <div><font face="arial, helvetica,
          sans-serif">(Supposing my .jar is in /some/path and the
          SolverConf.xml will be on /some/path/conf for example)</font></div>
      <div><font face="arial, helvetica,
          sans-serif"><br>
        </font></div>
      <div><font face="arial, helvetica,
          sans-serif">Thanks,</font></div>
      <div><font face="&#39;courier new&#39;,
          monospace"><br>
        </font></div>
      <div><font face="&#39;courier new&#39;,
          monospace"><br>
        </font></div>
      </div></div><pre><fieldset></fieldset>
_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
    </blockquote><font color="#888888">
    <br>
    <pre cols="72">-- 
With kind regards,
Geoffrey De Smet</pre>
  </font></div>

<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br></div>