Class NativeLoader

java.lang.Object
dev.vortex.jni.NativeLoader

public final class NativeLoader extends Object
Utility class for loading the native Vortex JNI library.

This class handles the platform-specific loading of the native Vortex library by detecting the operating system and architecture, extracting the appropriate native library from the classpath, and loading it into the JVM.

The loader supports Windows, macOS, and Linux platforms with automatic detection of the correct library file format (.dll, .dylib, or .so).

  • Method Details

    • loadJni

      public static void loadJni()
      Loads the native Vortex JNI library if it hasn't been loaded already.

      This method performs platform detection, extracts the appropriate native library from the classpath to a temporary file, and loads it using System.load(String). The method is thread-safe and will only perform the loading operation once per JVM session.

      The native library is expected to be located at: /native/{platform}-{arch}/libvortex_jni.{ext} where platform is one of: win, darwin, linux and ext is the appropriate library extension for the platform.

      Throws:
      UnsupportedOperationException - if the current platform is not supported
      RuntimeException - if the library cannot be extracted or loaded