yanl – yet another native loader

Yet another Native library extractor/loader for the
JVM, written in Kotlin.


other libraries simply don’t fit my needs and/or aren’t as
expandable/configurable as I’d like.

how use

this is going to go over how to setup
yanl on a
gradle project using a Kotlin DSL buildscript.

first you need to import the library, you can either import it from
the maven central repository or
from jitpack automatic builds.

for maven central, just add
yanl to your dependencies block:

// change to the latest version
val YANL_VERSION = "1.0.0" 

dependencies {

for jitpack, add the repository as well as the dependency,
this time using the github domain:

// change to the latest github release, commit, or branch name
val YANL_RELEASE = "1.0.0" 

repositories {

dependencies {

how work

this library can act as a simple drop-in replacement to your standard
System.load or System.loadLibrary.

consider the following example:

public class Program {
    public static void main(String[] args) {
        // requires the native file to be in path
        // do stuff
        // ...

this would require the library file to be somewhere on the PATH of the
operating system.

one way of getting around this problem would be to extract the library from
the jar archive to a known folder, then to load it. this approach works
but also requires to extract and load the correct library for your
processor architecture and operating system.

this is when yanl
comes into play.

yanl takes care of platform
detection, library extraction and location.

taking back that previous example:

import fr.stardustenterprises.yanl.loader.NativeLoader;

public class Program {
    public static void main(String[] args) {
        // load the library using yanl's default loader
        // do more stuff 
        // ...

this time yanl will handle
everything according to the NativeLoader
default settings.

you can of course change those setting by creating yourself a loader instance:

// library not done, example snippet not available, check back later!


this project is under the MIT license.


View Github