Shared Libraries in Java AWS Lambda Project

2019-08-17 02:36发布

问题:

In my java class System.loadLibrary() is not able to locate the library files. I have used Gradle build to zip file in below structure:

  • zip
    • mypackage
      • App.class
      • GatewayResponse.class
    • lib
      • set of jars and shared libraries

Lambda service is able to load my jar but not libraries.

Imagine example.jar and libExample.so are part of my lib directory.

From App class: I have created an object of some class in the example.jar and it works fine. when I try to load the library libExample.so using system.loadLibrary(), it fails.

I have used the LD_LIBRARY_PATH property to specify the path of native libraries in AWS Lambda

It works perfectly on my local machine.