How to use JNAerator with several dynamic libraries under one heading?

I use JNAerator to create a single jar file that I can include in a project, and I would like to maintain dynamic libraries for each operating system and create everything in this single bank.

While I am working with JNAerator, I was able to enable one dynamic library using the following command:

java -jar jnaerator.jar test.dll test.h [...] -mode StandaloneJar

However, it only packages test.dll, while I have DLLs for several systems ( test_win32.dll, test_win64.dll, libtest_mac.dylib, libtest_linux_x86.soand libtest_linux_amd64.so) that I'd like to see all packed and maintained a jar.

Is there a way to make this all-in-one approach with a single JNAerator run, or do I need to create a different jar file for each platform?

+4
source share
1 answer

JNAerator has a parameter specifically -archdesigned for this, although the document is currently terribly vague about it :

java -jar jnaerator-0.12-shaded.jar \
  -arch win32 win32/test.dll \
  -arch win64 win64/test.dll \
  -arch darwin_universal mac/libtest.dylib \
  -arch linux_x86 linux_x86/libtest.so \
  -arch linux_x64 linux_amd64/libtest.so \
  test.h \
  -mode StandaloneJar \
  -jar test.jar

This will combine the libraries under the format expected by BridJ (see its wiki page on embedded binaries ):

unzip -l test.jar gives:

    ...
    0  04-09-15 22:45   lib/win32/test.dll
    0  04-09-15 22:45   lib/win64/test.dll
    0  04-09-15 22:45   lib/darwin_universal/libtest.dylib
    0  04-09-15 22:45   lib/linux_x86/libtest.so
    0  04-09-15 22:45   lib/linux_x64/libtest.so

Currently, library names must be exact lib<name>.(so|dylib)or <name>.dllfor each platform, although this can be easily fixed if you ask .

(note: I am the author of BridJ and JNAerator)

+8
source

All Articles