B4J Question MacSigner with native libraries

yo3ggx

Active Member
Licensed User
Longtime User
I have an application that use two native libraries: jssc.dylib and libopus.dylib. The application is running as expected when linked with MacSigner and the native files for the x86-64 architecture are copied in the temp/build/lib folder.
When I package the application with MacSigner and I'm trying to run the app, I get the error:
B4X:
Native library (darwin-x86-64/libopus.dylib) not found in resource path ()

I tried to create a subfolder named darwin-x86-64 in the lib folder, but I get the same result.

When I package the application for Windows directly from the IDE and copy the native dll's in the bin folder, all is working as expected.

Any hints on where the native libraries must be copied for the packaged app to run as expected on a Mac?

Thank you.
 
Last edited:

yo3ggx

Active Member
Licensed User
Longtime User
After some more troubleshooting, I'm answering myself.
The file libopus.dylib was in the wrong folder inside the application jar file:
darwin/
instead of
darwin-x86-64/

Now .... the question is: if the native file is already part of the app jar file, why is needed to manually copy it in the lib folder? The packager cannot take it directly from the jar file? Same question for all OSes, including Windows.
Why if I run the jar file directly (with java -jar ...) it works even if the native library is in the wrong subfolder?
 
Upvote 0

yo3ggx

Active Member
Licensed User
Longtime User
I understand that, but my impression was that the jar file is unzipped when package is built (as is no more part of the package). Based on the current OS, the native libraries from the app jar file cannot be moved to the right location automatically?
 
Upvote 0
Top