[armedbear-devel] how to load fasls from jar via asdf

Mark Evenson evenson at panix.com
Mon Aug 23 15:24:53 UTC 2010


On 8/23/10 4:53 PM, Robert Dodier wrote:
> Hi,
>
> After looking through various web pages, emails, etc,
> I gather it's possible to load all the fasls for some
> program from a jar via asdf.
> However, I tried the obvious things and I couldn't get
> it to work. Can someone explain how it's supposed to work?
>
> I have all the fasls for Maxima in a subdirectory.
> (require 'asdf) (asdf:operate 'asdf:load-op :maxima)
> has the desired effect. So far, so good.
>
> I put all the fasls in a jar (either in the subdirectory
> or without the subdirectory), and then
> (pushnew "jar:file:/path/to/my.jar" asdf:*central-repository*)
> But when I try
> (require 'asdf) (asdf:operate 'asdf:load-op :maxima)
> I eventually get a message about trying to find the
> first Lisp file mentioned in the maxima.asd, which I'm
> pretty sure it didn't find the fasls.

A JAR-PATHNAME needs a reference to the directory to refer to "inside" a 
jar which is distinguished by the "!/" character sequence, so the form 
must always be

	jar:URL!/PATH

where URL is usually a file URL (i.e. "file:/path/to/my.jar", although 
it can refer to an "http", "ftp" or any other scheme that the JVM will 
pass through the java.net.URL constructor).  The PATH may be the empty 
string in which case it refers to the root directory inside the jar, but 
otherwise it is a "normal" namestring for a PATHNAME that refers to
a sub-directory and/or a file.  This nomenclature is taken from the 
[defacto standard as described in the java.net.JarUrlConnection 
javadocs][1].

[1]: 
http://webcache.googleusercontent.com/search?q=cache:PaMdUkE7-5MJ:download.oracle.com/javase/6/docs/api/java/net/JarURLConnection.html+java.net.JarUrlConnection+java+6&cd=1&hl=en&ct=clnk&gl=at&client=firefox-a

For your example, assuming you have packaged up Maxima in the directory 
"maxima" within the jar (i.e. there is a file "maxima/maxima.asd" in the 
archive, you would need to slightly modify your recipe to
	
	(pushnew "jar:file/path/to/my.jar!/maxima/" asdf:*central-repository*)

note the usual trailing '/' to denote a directory to the CL PATHNAME 
machinery.

To LOAD a given file within a JAR,

	(load "jar:file:/path/to/my.jar!/foo")

will search the "root" directory inside the jar for the usual suspects 
"foo.abcl" and "foo.lisp"

[…]

-- 
"A screaming comes across the sky.  It has happened before, but there
is nothing to compare to it now."




More information about the armedbear-devel mailing list