native-utils | simple library class which helps with loading dynamic JNI | Wrapper library

 by   adamheinrich Java Version: Current License: MIT

kandi X-RAY | native-utils Summary

kandi X-RAY | native-utils Summary

native-utils is a Java library typically used in Utilities, Wrapper applications. native-utils has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. You can download it from GitHub.

A simple library class which helps with loading dynamic libraries stored in the JAR archive. These libraries usualy contain implementation of some methods in native code (using JNI - Java Native Interface).
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              native-utils has a low active ecosystem.
              It has 214 star(s) with 84 fork(s). There are 19 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 4 open issues and 3 have been closed. On average issues are closed in 169 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of native-utils is current.

            kandi-Quality Quality

              native-utils has 0 bugs and 0 code smells.

            kandi-Security Security

              native-utils has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              native-utils code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              native-utils is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              native-utils releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              native-utils saves you 47 person hours of effort in developing the same functionality from scratch.
              It has 125 lines of code, 8 functions and 3 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed native-utils and discovered the below as its top functions. This is intended to give you an instant insight into native-utils implemented functionality, and help decide if they suit your requirements.
            • Loads a library from the JAR archive
            • Create a temporary directory
            • Checks if is posix compliant
            Get all kandi verified functions for this library.

            native-utils Key Features

            No Key Features are available at this moment for native-utils.

            native-utils Examples and Code Snippets

            No Code Snippets are available at this moment for native-utils.

            Community Discussions

            QUESTION

            Encapsulating a JNI library inside a jar file
            Asked 2020-Feb-20 at 21:10

            I am trying to develop a plugin for Fiji/ImageJ that relies on a native library (JNI). The JNI library itself depends on libtiff and fftw. On OSX and Linux, I use the class NativeUtils and everything works fine.

            On windows, I included binary versions of libtiff and fftw in the CMake package and managed to link the JNI library against those (either statically of dynamically). However, the resulting JNI module does not include libtiff or fftw and I obtain an error when I try to load the JNI library with NativeUtils.loadLibraryFromJar. This is also the case when I include the dependent .dll in the .jar since they are not extracted by NativeUtils.

            Here are the relevant lines in CMakeLists.txt:

            ...

            ANSWER

            Answered 2020-Feb-20 at 21:10

            You can't load library from inside JAR without extracting it in a first place.

            Take a look here at full sample where native code is embedded inside JAR and extracted when needed.

            https://github.com/mkowsiak/jnicookbook/tree/master/recipes/recipeNo031

            Update

            Well, in that case, when you need to pack more libs and you want to properly resolve locations, you need to play with runtime env a little bit.

            Take a look here:

            https://github.com/mkowsiak/jnicookbook/tree/master/recipes/recipeNo035

            Source https://stackoverflow.com/questions/46609450

            QUESTION

            JNA Native.loadLibrary generates a memory failure: __memmove_avx_unaligned_erms
            Asked 2018-Jun-28 at 12:51

            I develop an app in java that loads a C++ shared library using JNA. The detailed procedure is the following.

            1. Find library in the jar
            2. use System.load( C_LIBRARY_PATH ) with the result of step 1
            3. Load library using JNA tools: Wrapper INSTANCE = Native.loadLibrary( C_LIBRARY_PATH, Wrapper.class );

            This procedure is used to create a wrapper of the c++ library and hence produces a java library that is used for other projects. Point 1 and 2 are inspired by the work of adamheinrich. The existence of the file is checked before calling the load function.

            When using the java wrapper in a project I randomly have an error like below. Could you guide me in debugging and try to control this random failure?

            ...

            ANSWER

            Answered 2018-Jun-28 at 12:51

            I was accidentally loading twice the same library in multiple java classes. More precisely, the call Wrapper INSTANCE = Native.loadLibrary( C_LIBRARY_PATH, Wrapper.class ); was done in a nested interface that I replicated in all the different objects that were using the same c++ library. This, as reminded by @cubrr, is done statically at instantiation of the first object. Hence the library was loaded multiple times. Below a speudo-code illustrating my mistake.

            Source https://stackoverflow.com/questions/51057895

            QUESTION

            jna Native.LoadLibrary does not manage to load library on server (working in local)
            Asked 2018-Mar-23 at 10:22

            I use JNA to load a c++ library (.so) in a java project. I package my library inside the jar, and load it from the jar when instantiating the java class that uses it. I do all this like so:

            • mvn install compiles the c++ code and packages the outcome dynamic library inside the jar.
            • I call in a static context when instantiating the LibraryWrapperClass the following

              ...

            ANSWER

            Answered 2018-Mar-21 at 14:25

            How could I debug?

            1. with strace

            strace will give you what files Tomcat is trying to open : strace -f -e trace=file -o log.txt bin/startup.sh

            After this, look for packageName in log.txt, or other files not found with :

            Source https://stackoverflow.com/questions/49359639

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install native-utils

            You can download it from GitHub.
            You can use native-utils like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the native-utils component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/adamheinrich/native-utils.git

          • CLI

            gh repo clone adamheinrich/native-utils

          • sshUrl

            git@github.com:adamheinrich/native-utils.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Wrapper Libraries

            jna

            by java-native-access

            node-serialport

            by serialport

            lunchy

            by eddiezane

            ReLinker

            by KeepSafe

            pyserial

            by pyserial

            Try Top Libraries by adamheinrich

            os.h

            by adamheinrichC

            RaspiCV

            by adamheinrichC

            RaspiCalib

            by adamheinrichC

            nanomidi

            by adamheinrichC

            gpsdate

            by adamheinrichC