Re: Custom Java build pack with C Shared Object


Ben Hale <bhale@...>
 

I've been trying for a while now to get a C-Library uploaded with a Java application in Cloud Foundry. However, as soon as I introduce the C library I get the following error:

Depending on how widely the native library is used, you probably don’t need to fork the buildpack to accomplish what you are looking to do. In general, libraries can be packaged within JAR files (I’d recommend inside of `META-INF` since that folder cannot be read from a `ClassLoader`). Once you have the library within the droplet, you can point at it with either a JAVA_OPTS (`-Djava.library.path=$PWD/META-INF`) or environment variable (`LD_LIBRARY_PATH=$PWD/META-INF`).

If a large number of applications use native libraries, then a fork of the buildpack is warranted. You should introduce a new framework that versions, downloads, caches, and expands the library archive and you can use the public API in order to reference the location via either JAVA_OPTS or environment variables[1].


-Ben Hale
Cloud Foundry Java Experience


[1]: https://github.com/cloudfoundry/java-buildpack/blob/master/lib/java_buildpack/framework/dyadic_ekm_security_provider.rb#L44-L53

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.