Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include platform-specific java dependencies (without setting my hair on fire)

I would like to make use of the HDF5 java library from Clojure. Unfortunately, the usual way of including java dependencies (i.e. via Leiningen's support for Maven repositories) isn't available. This is likely because the HDF5-Java library is a JNI-wrapped set of compiled C++ and Fortran code.

I looked at Maven-izing a recent version of HDF5-Java, but didn't understand how platform-specific versions were handled there / decided that was far too much of a pain. Assuming I'm stuck using platform-specific jars released by the HDF group, is there a relatively good way to handle these, while continuing to mostly live within the comfortable world of Leiningen?

like image 742
Peter Avatar asked Nov 12 '22 11:11

Peter


1 Answers

I've never tried this myself, but it looks like you should be able to native dependencies in Leiningen by packaging up the HDF5 library into a JAR file following the directory structure described here, installing it in Maven, and adding a regular dependency on that library in project.clj. Leiningen should handle the dirty work of detecting your OS and architecture and including the correct parts on your project classpath.

For more reading, check out:

http://nakkaya.com/2010/04/05/managing-native-dependencies-with-leiningen/

http://bially.posterous.com/using-jogl-in-your-clojure-project

Clojure, Lein, JavaFx, native deps

like image 63
Alex Avatar answered Nov 15 '22 07:11

Alex