Code Monkey home page Code Monkey logo

native-lib-loader's Introduction

About native library loader

The native library loader is a utility that assists with loading native libraries from Java. It provides the ability to painlessly identify, extract and load the correct platform-specific native library from a JAR file.

License

Simplified BSD License

Usage

Add dependency

Search Maven Central for latest version and add a dependency to your pom.xml.

<dependency>
    <groupId>org.scijava</groupId>
    <artifactId>native-lib-loader</artifactId>
    <version>x.y.z</version>
</dependency>

Package native libraries

Native libraries should be packaged into a single jar file, with the following directory & file structure:

/natives
  /linux_32
     libxxx[-vvv].so
  /linux_64
     libxxx[-vvv].so
  /osx_32
     libxxx[-vvv].dylib
  /osx_64
     libxxx[-vvv].dylib
  /osx_arm64
     libxxx[-vvv].dylib
  /windows_32
     xxx[-vvv].dll
  /windows_64
     xxx[-vvv].dll
  /windows_arm64
     xxx[-vvv].dll
  /aix_32
     libxxx[-vvv].so
     libxxx[-vvv].a
  /aix_64
     libxxx[-vvv].so
     libxxx[-vvv].a

Here "xxx" is the name of the native library and "-vvv" is an optional version number. Depending on the platform at runtime, a native library will be unpacked into a temporary file and will be loaded from there.

The version information will be grabbed from the MANIFEST.mf file from "Implementation-Version" entry. So it's recommended to follow Java's package version information convention.

Load library

If you want to load 'awesome.dll' (on Windows) or 'libawesome.so' (on Linux or AIX), simply do like this ...

NativeLoader.loadLibrary("awesome");

native-lib-loader's People

Contributors

bmarwell avatar ctrueden avatar dscho avatar extensia avatar grislis avatar hinerm avatar imagejan avatar melissalinkert avatar nitram509 avatar rationalityfrontline avatar sbesson avatar shaquu avatar tresf avatar xanthorapedia avatar zhkl0228 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.