JNA: The specified module could not be found in compiled jar





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have a C++ .dll in my java Spring Boot project.
Everything looks good and method from .dll is called when:




  1. I run application from IDE

  2. I compile file with mvn pack & java -jar target/Project-0.0.1-SNAPSHOT.jar


I tried to copy project to another machine and I got this problem:




  1. When I run application from IDE everything is ok


  2. When I run same command on project mvn pack & java -jar target/Project-0.0.1-SNAPSHOT.jar and it's called .dll method it crash with message error:



java.lang.UnsatisfiedLinkError: The specified module could not be found.



    at com.sun.jna.Native.open(Native Method) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
at com.sun.jna.Native.open(Native.java:1759) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
at com.sun.jna.Library$Handler.<init>(Library.java:147) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
at com.sun.jna.Native.loadLibrary(Native.java:412) ~[jna-4.1.0.jar!/:4.1.0 (b4)]`.


Note: I have Microsoft Visual C++ 2017 Redistributable on both machines.



If I move .dll file in project root directory it works.










share|improve this question































    0















    I have a C++ .dll in my java Spring Boot project.
    Everything looks good and method from .dll is called when:




    1. I run application from IDE

    2. I compile file with mvn pack & java -jar target/Project-0.0.1-SNAPSHOT.jar


    I tried to copy project to another machine and I got this problem:




    1. When I run application from IDE everything is ok


    2. When I run same command on project mvn pack & java -jar target/Project-0.0.1-SNAPSHOT.jar and it's called .dll method it crash with message error:



    java.lang.UnsatisfiedLinkError: The specified module could not be found.



        at com.sun.jna.Native.open(Native Method) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
    at com.sun.jna.Native.open(Native.java:1759) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
    at com.sun.jna.Library$Handler.<init>(Library.java:147) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
    at com.sun.jna.Native.loadLibrary(Native.java:412) ~[jna-4.1.0.jar!/:4.1.0 (b4)]`.


    Note: I have Microsoft Visual C++ 2017 Redistributable on both machines.



    If I move .dll file in project root directory it works.










    share|improve this question



























      0












      0








      0








      I have a C++ .dll in my java Spring Boot project.
      Everything looks good and method from .dll is called when:




      1. I run application from IDE

      2. I compile file with mvn pack & java -jar target/Project-0.0.1-SNAPSHOT.jar


      I tried to copy project to another machine and I got this problem:




      1. When I run application from IDE everything is ok


      2. When I run same command on project mvn pack & java -jar target/Project-0.0.1-SNAPSHOT.jar and it's called .dll method it crash with message error:



      java.lang.UnsatisfiedLinkError: The specified module could not be found.



          at com.sun.jna.Native.open(Native Method) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
      at com.sun.jna.Native.open(Native.java:1759) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
      at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
      at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
      at com.sun.jna.Library$Handler.<init>(Library.java:147) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
      at com.sun.jna.Native.loadLibrary(Native.java:412) ~[jna-4.1.0.jar!/:4.1.0 (b4)]`.


      Note: I have Microsoft Visual C++ 2017 Redistributable on both machines.



      If I move .dll file in project root directory it works.










      share|improve this question
















      I have a C++ .dll in my java Spring Boot project.
      Everything looks good and method from .dll is called when:




      1. I run application from IDE

      2. I compile file with mvn pack & java -jar target/Project-0.0.1-SNAPSHOT.jar


      I tried to copy project to another machine and I got this problem:




      1. When I run application from IDE everything is ok


      2. When I run same command on project mvn pack & java -jar target/Project-0.0.1-SNAPSHOT.jar and it's called .dll method it crash with message error:



      java.lang.UnsatisfiedLinkError: The specified module could not be found.



          at com.sun.jna.Native.open(Native Method) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
      at com.sun.jna.Native.open(Native.java:1759) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
      at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
      at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
      at com.sun.jna.Library$Handler.<init>(Library.java:147) ~[jna-4.1.0.jar!/:4.1.0 (b4)]
      at com.sun.jna.Native.loadLibrary(Native.java:412) ~[jna-4.1.0.jar!/:4.1.0 (b4)]`.


      Note: I have Microsoft Visual C++ 2017 Redistributable on both machines.



      If I move .dll file in project root directory it works.







      java c++ dll java-native-interface jna






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 26 '18 at 16:44







      GameZone RO

















      asked Nov 26 '18 at 15:31









      GameZone ROGameZone RO

      1817




      1817
























          1 Answer
          1






          active

          oldest

          votes


















          0














          You are using JNA inside your project. JNA requires some native libraries be properly installed. E.g. it needs jnidispatch.dll for Windows platform.



          For your case, you need to download the required native libs, e.g. https://github.com/java-native-access/jna/blob/master/lib/native/win32, and put it into a directory where can be searched by your JAVA.






          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53484413%2fjna-the-specified-module-could-not-be-found-in-compiled-jar%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            You are using JNA inside your project. JNA requires some native libraries be properly installed. E.g. it needs jnidispatch.dll for Windows platform.



            For your case, you need to download the required native libs, e.g. https://github.com/java-native-access/jna/blob/master/lib/native/win32, and put it into a directory where can be searched by your JAVA.






            share|improve this answer




























              0














              You are using JNA inside your project. JNA requires some native libraries be properly installed. E.g. it needs jnidispatch.dll for Windows platform.



              For your case, you need to download the required native libs, e.g. https://github.com/java-native-access/jna/blob/master/lib/native/win32, and put it into a directory where can be searched by your JAVA.






              share|improve this answer


























                0












                0








                0







                You are using JNA inside your project. JNA requires some native libraries be properly installed. E.g. it needs jnidispatch.dll for Windows platform.



                For your case, you need to download the required native libs, e.g. https://github.com/java-native-access/jna/blob/master/lib/native/win32, and put it into a directory where can be searched by your JAVA.






                share|improve this answer













                You are using JNA inside your project. JNA requires some native libraries be properly installed. E.g. it needs jnidispatch.dll for Windows platform.



                For your case, you need to download the required native libs, e.g. https://github.com/java-native-access/jna/blob/master/lib/native/win32, and put it into a directory where can be searched by your JAVA.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 29 '18 at 6:12









                shizhenshizhen

                4,13441337




                4,13441337
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53484413%2fjna-the-specified-module-could-not-be-found-in-compiled-jar%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Wiesbaden

                    Marschland

                    Dieringhausen