Lisp filepath issues when running application directly from jar file

Ralph Ritoch rritoch at gmail.com
Sat Aug 15 15:39:35 UTC 2015


Hello,

  Since you are loading resources and not from the filesystem you probably
want to utilize the load-system-file function which I believe is provided
by the :sys package. I'm not sure how portable this is so you may want to
add some additional control logic if you want portability.

(load-system-file "path/to/resource.lisp")

Best Regards,
  Ralph Ritoch

On Fri, Aug 14, 2015 at 8:00 PM, <armedbear-devel-request at common-lisp.net>
wrote:

> Send armedbear-devel mailing list submissions to
>         armedbear-devel at common-lisp.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mailman.common-lisp.net/listinfo/armedbear-devel
> or, via email, send a message with subject or body 'help' to
>         armedbear-devel-request at common-lisp.net
>
> You can reach the person managing the list at
>         armedbear-devel-owner at common-lisp.net
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of armedbear-devel digest..."
>
>
> Today's Topics:
>
>    1. Lisp filepath issues when running application directly from
>       jar file (Hamda Binte Ajmal)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 14 Aug 2015 11:20:18 +0100
> From: Hamda Binte Ajmal <hamda.binte.ajmal at gmail.com>
> To: armedbear-devel at common-lisp.net
> Subject: Lisp filepath issues when running application directly from
>         jar file
> Message-ID:
>         <CAJEb=
> LPJuCP6FJoTxuCGaapbo4FHdjnWdEf_QumgMJF-9BhHXQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi,
> I was working on an application, that loads a few lisp files using lisp
> command
> (load "fullfilepath.lisp") from java using ABCL.
> This file in turn loads the other lisp files located in same folder
> hierarchy, and then i call lisp functions (defined in these files) from
> java and everything works perfect as long as I run the application from
> Netbeans.
> Close to deployment, I tested the application by running it from jar file,
> I found that there are issues with filepaths, as the files are not a part
> of file-system, and hence not accessible using a file-path.
> Does anyone has any idea how to fix this issue ?
> I tried many things, like
>
> URL url =
> LispConnector.class.getResource("/Aima/aima/quicklisp/setup.lisp");String
> path = url.getFile();File f = new File(path);
> path = f.getAbsolutePath();
> path = path.replace("\\", "/");
>
> which returns [image: enter image description here]
>
> But which is wrong as this is not a valid file path and does not exists so
> lisp : (load "filepath") fails here.
>
> When I use the code
>
> String path = url.toURI();File = new File(path);
> path = path.getAbsolutePath();
>
> Again it works fine while running from netbeans, but shows error "URI is
> not hierarchical" error while running the jar file.
>
> Has anyone encountered this issue, please help.
>
>
> --
> Hamda Binte Ajmal
> NUIG, Ireland
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20150814/f1757e48/attachment-0001.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> armedbear-devel mailing list
> armedbear-devel at common-lisp.net
> https://mailman.common-lisp.net/listinfo/armedbear-devel
>
>
> ------------------------------
>
> End of armedbear-devel Digest, Vol 16, Issue 8
> **********************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20150815/99763e08/attachment.html>


More information about the armedbear-devel mailing list