Lisp filepath issues when running application directly from jar file

Hamda Binte Ajmal hamda.binte.ajmal at gmail.com
Mon Aug 17 11:08:32 UTC 2015


Hi Mark,
I tried option one, using code
            File jarFile = new
File(codeSource.getLocation().toURI().getPath());
            String jarDir = jarFile.getParentFile().getPath();
            String pathname =  jarDir + "/JavaApplication17.jar!" +
"/aima/quicklisp/setup.lisp";
            JavaApplication17 d = new JavaApplication17();
            d.Setup();
            String str = "(load \"jar:file:/" + pathname + "\")";
            str = str.replace("\\", "/");
            d.execute(str);

It gives this error "Cant ensure directory"
[image: Inline image 1]

On Sat, Aug 15, 2015 at 8:28 AM, Mark Evenson <evenson at panix.com> wrote:

>
> On Aug 14, 2015, at 12:20, Hamda Binte Ajmal <hamda.binte.ajmal at gmail.com>
> wrote:
>
> 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 ?
>
>
> ABCL has [extended the semantics of Lisp PATHNAME objects to be able to
> refer
> to files within jar files][1].
>
> [1]:
>
> http://abcl.org/trac/browser/trunk/abcl/doc/design/pathnames/jar-pathnames.markdown
>
> If you know the absolute path of the jar file locally, you may specify a
> file
> within via something that looks like:
> “jar:file:/absolute/path/to/file.jar!/path/within/jar/setup.lisp”.  See the
> above referenced design specification for more details.
>
> The [ASDF-JAR contrib][2] provides a convenient mechanism for packaging
> Common
> Lisp systems encapsulated by ASDF into a jar that may subsequently used as
> the
> basis for loading these systems via the ASDF-JAR:ADD-TO-ASDF function.
>
> [2]:
> http://abcl.org/trac/browser/trunk/abcl/contrib/asdf-jar/README.markdown
>
> Both these options require that you know the absolute path of the deployed
> jar.
> JAR-PATHNAME objects follow CL:MERGE-PATHNAME conventions, so one may be
> able
> to figure out runtime locations based on the user home directory.
>
> […]
>
> Please let me know if I can be of further assistance here.
>
>
> --
> "A screaming comes across the sky.  It has happened before but there is
> nothing
> to compare to it now."
>
>
>
>
>
>


-- 
Hamda Binte Ajmal
+92 344 550 7680
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20150817/9cfb63f1/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 59276 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20150817/9cfb63f1/attachment-0001.png>


More information about the armedbear-devel mailing list