[armedbear-devel] Building with Netbeans
Mark Evenson
evenson at panix.com
Fri Feb 12 08:47:47 UTC 2010
On 2/11/10 7:45 PM, Paul Griffioen wrote:
[…]
> I work with Netbeans 6.8 (just upgraded for ANT) and run the build from
> the menu. Running the generated jar with 'java -jar abcl.jar geeft'
> gives the following message:
>
> Failed to load Main-Class manifest attribute from
> abcl.jar
>
> I noticed that the manifest.mf just contains the following:
>
> Manifest-Version: 1.0
> Ant-Version: Apache Ant 1.7.1
> Created-By: 1.6.0_0-b11 (Sun Microsystems Inc.)
> Class-Path:
>
> Is the Netbeans build supposed to work? Does anybody have any idea why
> the Main is not in the generated manifest?
You have found a bug for which I've applied a fix to make the Netbeans
produced runnable JARs in [svn r12449][1].
Although we use Netbeans for interactive debugging, we typically do
final packaging of ABCL by running the Ant task 'abcl.jar', which is
unfortunately a different code path than the way Netbeans generates the
jar. Although Netbeans creates 'dist/abcl.jar' it never executes it
itself, instead using the buildpath elements, so we hadn't really tested
the Netbeans produced JAR.
[1]: http://trac.common-lisp.net/armedbear/changeset/12449
> A second question is what the best way is to include the jna library.
> I'm trying to compile CFFI with ABCL but that required jna as the
> following quote from CFFI's code shows:
>
> ;;; This implementation requires the Java Native Access (JNA) library.
> ;;; <http://jna.dev.java.net/>
>
> I downloaded the required jna.jar and figured that I could include it
> somehow in abcl.jar after building that. Unfortunately that build failed
> but I would like to be able to use it from Netbeans anyway. Does anybody
> know how to do that? My knowledge of the Java ecosystem is limited so
> figuring this out for ABCL specifically is not easy.
Which version CFFI? I know that [Luís Olivera had created some
patches][2] last Summer, but I didn't know if they had been merged back
into the CFFI main distribution. Fleshing out his implementation (it
was missing callbacks) is one of my many todo items. I'd be interested
in hearing about your experiences (when you have some!)
[2]: http://common-lisp.net/~loliveira/patches/cffi-abcl.diff
Incorporating additional JAR files in the Netbeans build involves 1)
Opening the project properties dialog by choosing "File >> Project
Properties" from the main menu bar. 2) Under categories choosing
"Libraries". 3) Choosing "Run" from the type of libraries. 4) Choose
"Add JAR/Folder" 5) choose the local path location of 'jna.jar'.
But the preferred way to add JAR files to the ABCL runtime classpath is
to set the 'additional.jars' property and use the 'abcl.wrapper' task.
To do this first copy the file 'build.properties.in' to
'build.properties'. Then add a line
additional.jars=/Path/to/jna.jar
specifying the local location of 'jna.jar'. Now, when the task
'abcl.wrapper' is executed an 'abcl' ('abcl.bat' under Microsoft
Windows) script is created which includes the contents of this property
in the classpath. Note that this wrapper script can't be executed
directly by Netbeans, which is was goal of your question.
To execute 'abcl.wrapper' from Netbeans, open 'build.xml' in the
Navigator view. Right click on the 'abcl.wrapper' target, the choose
"Run Target" from the popup menu.
>
> Finally I would appreciate feedback on the following patch for
> TRIVIAL-FEATURES I needed to write to get CFFI to compile. It turned out
> that the endianess feature wasn't set.
>
> diff -rN old-trivial-features/src/tf-abcl.lisp
> new-trivial-features/src/tf-abcl.lisp
> 31c31,38
> < ;;; TODO
> ---
> > (pushnew (let ((order (jcall "toString"
> > (jstatic "nativeOrder"
> "java.nio.ByteOrder"))))
> > (cond ((string-equal order "LITTLE_ENDIAN")
> > :little-endian)
> > ((string-equal order "BIG_ENDIAN")
> > :big-endian)
> > (t (error "Byte order ~A unknown" order))))
> > *features*)
>
> Like I said, I'm no Java expert and feedback would be helpful.
Your Java code looks fine. I don't know the semantics of
TRIVIAL-FEATURES, but note that ABCL itself is :BIG-ENDIAN as that is
the standard for the JVM. Of course, CFFI needs to know the endian
nature of the external interface, so your code is reasonable for CFFI's
usage.
--
"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