<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi Guilharme,<br>
<br>
There'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("<font
class="Apple-style-span" face="'courier new', monospace">/path/to/xml/file/SolverConf.xml");</font><br>
configurer.configure(in);<br>
} finally {<br>
IOUtils.closeSilently(in);<br>
}<br>
<br>
Op 11-10-11 15:01, Guilherme Kunigami schreef:
<blockquote
cite="mid:CAK0MeX72okRD3FPFHbm7ewoK80BQ09zHQuWMRJz5JBLRMFAuLg@mail.gmail.com"
type="cite">
<div>Hi,</div>
<div><br>
</div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">I'm trying to load a configuration file (namely
SolverConf.xml) into XmlSolver with the code below:</font></div>
<div>
<span class="Apple-style-span" style="font-family: 'courier
new',monospace;"><br>
</span></div>
<div>
<div><font class="Apple-style-span" face="'courier new',
monospace">XmlSolverConfigurer configurer = new
XmlSolverConfigurer();</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">configurer.configure(SOLVER_CONFIG);</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace">Solver solver = configurer.buildSolver();</font></div>
</div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">If I bundle SolverConf.xml file with the
application .jar file, then using </font><font
class="Apple-style-span" face="'courier new', monospace">SOLVER_CONFIG</font><font
class="Apple-style-span" face="arial, helvetica, sans-serif">
as </font><font class="Apple-style-span" face="'courier new',
monospace">/path/to/xml/file/SolverConf.xml</font><font
class="Apple-style-span" face="arial, helvetica, sans-serif">
works fine.</font></div>
<div><span class="Apple-style-span" style="font-family: 'courier
new',monospace;"><br>
</span></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">But I want to use SolverConf.xml outside the .jar,
so I can easiliy edit it, but I don't know what path should I
pass to it.</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif"><br>
</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">I know it's a Java related question, but I was
wondering if anyone had a similar problem when configuring
drools planner. (I've asked on stackoverflow, but none of the
answers worked for me: <a moz-do-not-send="true"
href="http://stackoverflow.com/questions/7718807/can-getresourceasstream-find-files-outside-the-jar-file">http://stackoverflow.com/questions/7718807/can-getresourceasstream-find-files-outside-the-jar-file</a>)</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif"><br>
</font></div>
<div><font class="Apple-style-span" 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 class="Apple-style-span" face="arial, helvetica,
sans-serif"><br>
</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">Thanks,</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<div><font class="Apple-style-span" face="'courier new',
monospace"><br>
</font></div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
With kind regards,
Geoffrey De Smet</pre>
</body>
</html>