jna-utils

The base parent for all open-source projects coming from mhoffrogge.

License

License

Categories

Categories

JNA Development Tools Native
GroupId

GroupId

de.mhoffrogge.jna
ArtifactId

ArtifactId

jna-utils
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

jna-utils
The base parent for all open-source projects coming from mhoffrogge.
Project Organization

Project Organization

mhoffrogge

Download jna-utils

How to add to project

<!-- https://jarcasting.com/artifacts/de.mhoffrogge.jna/jna-utils/ -->
<dependency>
    <groupId>de.mhoffrogge.jna</groupId>
    <artifactId>jna-utils</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/de.mhoffrogge.jna/jna-utils/
implementation 'de.mhoffrogge.jna:jna-utils:0.1.0'
// https://jarcasting.com/artifacts/de.mhoffrogge.jna/jna-utils/
implementation ("de.mhoffrogge.jna:jna-utils:0.1.0")
'de.mhoffrogge.jna:jna-utils:jar:0.1.0'
<dependency org="de.mhoffrogge.jna" name="jna-utils" rev="0.1.0">
  <artifact name="jna-utils" type="jar" />
</dependency>
@Grapes(
@Grab(group='de.mhoffrogge.jna', module='jna-utils', version='0.1.0')
)
libraryDependencies += "de.mhoffrogge.jna" % "jna-utils" % "0.1.0"
[de.mhoffrogge.jna/jna-utils "0.1.0"]

Dependencies

compile (1)

Group / Artifact Type Version
net.java.dev.jna : jna-platform jar 5.3.1

Project Modules

There are no modules declared in this project.

jna-utils

Utility package for Java JNA

Purpose

This module provides methods to extract native dynamic library files bundled in a JAR on the classpath to any folder on the runtime filesystem.
A single JAR can contain dynamic libraries for multiple platforms.
This utility module will load the appropriate library based on the actual platform at runtime.

Maven

<dependency>
  <groupId>de.mhoffrogge.jna</groupId>
  <artifactId>jna-utils</artifactId>
  <version>0.1.0</version>
</dependency>

Features

  • A single JAR can contain native dynamic libraries for multiple platforms.
  • The target directory of the unpacked dynamic libraries will be prepended to the environment settings of java.library.path as well as to the OS PATH (Windows) or LD_LIBRARY_PATH (Linux) variable.
  • If the native dynamic librar(y|ies) ecplicitely loaded by your application depend on other dynamic libraries not being loaded explicitley, then those dependent libraries can be bundled as well and they will be found by the OS loader due to the previously mentioned environment variable updates
  • All dynamic libraries found in folder /<com.sun.jna.Platform.RESOURCE_PREFIX> will be extracted

Conventions

  • The bundled dynamic libraries must be located in folder /<com.sun.jna.Platform.RESOURCE_PREFIX> inside the JAR:
 /
 ├──win32-x86
 │   ├──foo_jna_loaded.dll
 │   └──foo_required.dll
 │
 └──win32-x86-64
     ├──foo_jna_loaded.dll
     └──foo_required.dll
  • The JAR to be used for extracting native dynamic libraries is determined on the classpath by passing a JARs class to the appropriate jna-utils API method.
  • If there are multiple JARs on the classpath containing the same reference class, only the first JAR found on the classpath will be used for looking up the native libraries

Limitations

  • Currently only Windows and Linux platforms supported
  • Linux not yet tested

License

This project is licensed under Apache License, Version 2.0.

Versions

Version
0.1.0