How to load the jna jar file before cffi?

Mark Evenson evenson at
Thu May 11 06:23:22 UTC 2017

On 5/10/17 22:24, Mirko Vukovic wrote:
> Hello,
> In order for CFFI to load, I need to load jna-4.2.2.jar.
> Right now, I have to do something like this:
> (let ((jar-pathname
> #P"c:/Users/977315/.m2/repository/net/java/dev/jna/jna/4.2.2/jna-4.2.2.jar"))
>   (java:add-to-classpath (namestring jar-pathname)))
> To automate loading of ASDFs that require CFFI I tried to automate the
> process by adding a before method to 'load-op:
> (eval-when (:compile-toplevel :execute :load-toplevel)
>   (defmethod operate :before ((operation (eql 'asdf/lisp-action:load-op))
> (component (eql :cffi)))
>     (let ((jar-pathname
> #P"c:/Users/977315/.m2/repository/net/java/dev/jna/jna/4.2.2/jna-4.2.2.jar"))
>       (java:add-to-classpath (namestring jar-pathname)))))
> That did not work.  I did read the ASDF manual, but could not figure out
> how to do it.
> I suspect someone has figured out the right way.  What is it?

Such "manual" loading of the JNA should be not be necessary in the
default case of using ABCL-ASDF's Maven integration to download from the
network, which is what [the ABCL specific portion of][cffi] does.



  (require :jna)

refers to the [jna.asd][] definition, which is then passed to ABCL-ASDF
for resolution.


"All" that you need to do to get this to work is to have a version of
Maven installed.  The [ABCL-ASDF][1] code should find the Maven
executable in the JVM process path with which it will introspect the
necessary operations needed to use the Mavane Aether infrastructure.


To go forward with your problems:

1.  Do you have Maven installed or is there some reason in your
deployment scenario that you do not wish to use it?

2.  Without trying to load CFFI, does the following form load JNA from a
fresh REPL?

  (require :abcl-contrib)
  (require :jna)

"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