<div dir="ltr"><div><div><div><div><div><div>In addition to what Erik said, if I remember correctly, LOAD can take a stream as a parameter too, so if you can obtain a Java InputStream to the resource, you should be fine. I'm thinking about something like the following:<br>
<br></div>LispObject theLoadFunction = interpreter.eval("#'cl:load");<br></div>Stream resourceStream = new Stream(theJavaInputStream);<br></div>theLoadFunction.execute(resourceStream);<br><br></div>this is from memory and untested, so probably it won't work, but you should get the idea.<br>
<br></div>Of course, if you use the JSR-223 interface, that is handled for you already, but you're using Interpreter directly, and switching is not without cost, so you'll probably be better off if you follow Erik's suggestion or mine. <br>
<br></div>Alessio<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 4, 2013 at 9:57 PM, Erik Huelsmann <span dir="ltr"><<a href="mailto:ehuels@gmail.com" target="_blank">ehuels@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Joe,<div class="gmail_extra"><br><br><div class="gmail_quote"><div class="im">On Tue, Jun 4, 2013 at 7:17 PM, Joe Corneli <span dir="ltr"><<a href="mailto:holtzermann17@gmail.com" target="_blank">holtzermann17@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hello:<br>
<br>
I'm working with a Java developer and she tells me that this works:<br>
<br>
interpreter.eval("(load<br>
\"/<a href="http://people.kmi.open.ac.uk/ning/atms/decipher-atms-single-file.lisp%5C" target="_blank">http://people.kmi.open.ac.uk/ning/atms/decipher-atms-single-file.lisp\</a>")");<br></blockquote><div><br>
</div></div><div>(Assuming the leading dash in "/http" is a typo, this should indeed work...)</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
but this doesn't:<br>
<br>
interpreter.eval("(load \"/Decipher/codes/decipher-atms-single-file.lisp\")");<br></blockquote><div><br></div></div><div>But: this should work as well. Can you tell a bit more about the environment? Is this a Windows environment, ie an environment with multiple filesystem root directories? If not and this is on a *nix-like filesystem, I would not understand why this shouldn't work.</div>
<div><br></div><div>What means "doesn't work"? Does it mean something throws a Java exception? Does it mean the file content doesn't actually get loaded, but you see no errors? Is there a Common Lisp condition being thrown?</div>
<div class="im">
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Any idea about why this would be, and how we can load local code from<br>
a WAR web service?<br></blockquote><div><br></div></div><div>What I did in the past is pick a class which I know to be included in the JAR/WAR, something like "org.armedbear.lisp.Lisp", take its class and get the URL of the required resource from it like this (taken from src/org/armedbear/lisp/Site.java):</div>
<div><br></div><div><div> URL url = Lisp.class.getResource("boot.lisp");</div><div><br></div><div><br></div><div>HTH,</div><div><br></div><div><br></div><div>Erik.</div>
</div></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Some gratuitous spam:<br><br><a href="http://ripple-project.org" target="_blank">http://ripple.com</a> Ripple, social credit system<br><a href="http://common-lisp.net/project/armedbear" target="_blank">http://common-lisp.net/project/armedbear</a> ABCL, Common Lisp on the JVM<br>
<a href="http://code.google.com/p/tapulli" target="_blank">http://code.google.com/p/tapulli</a> my Lisp open source projects<br><a href="http://www.manydesigns.com/" target="_blank">http://www.manydesigns.com/</a> ManyDesigns Portofino, open source model-driven Java web application framework</div>
</div>