1 2 Previous Next 15 Replies Latest reply: Apr 14, 2012 8:45 AM by 824073 RSS

    Native library problem

    824073
      Hi all,

      I'm currently converting a desktop application to Java Web Start. This desktop application uses a native library (rxtx) and works just fine as a standalone application.

      I created a jar file that contains the native library (dll file) and added this to my deployment descriptor:
           <resources os="Windows" arch="x86">
                <nativelib href="native/rxtx32.jar"/>
                <jar href="native/swt32.jar"/>
           </resources>
           <resources os="Windows" arch="x86_64">
                <nativelib href="native/rxtx64.jar"/>
                <jar href="native/swt64.jar"/>
           </resources>
           <resources os="Windows" arch="amd64">
                <nativelib href="native/rxtx64.jar"/>
                <jar href="native/swt64.jar"/>
           </resources>
      Every time I run the application, I get this error:

      Caused by: java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path
           at java.lang.ClassLoader.loadLibrary(Unknown Source)
           at java.lang.Runtime.loadLibrary0(Unknown Source)
           at java.lang.System.loadLibrary(Unknown Source)

      I don't understand what I am missing. Does the jar file need to contain anything else other than the native dll?

      Thanks
        • 1. Re: Native library problem
          thomasng
          JNLP looks okay to me.

          the dll needs to be in the root directory of the native JAR.

          if you can post a URL to a test jnlp that can be used to reproduce the problem, that would be great.
          • 2. Re: Native library problem
            824073
            Thank you for your reply. The dll file is in the root of the jar file.

            I was testing locally, but I've temporarily uploaded the application here: http://www.balletdelvaulx.com/webstart/launch.jnlp
            • 3. Re: Native library problem
              DrClap
              mmg wrote:
              Caused by: java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path
              I don't understand what I am missing. Does the jar file need to contain anything else other than the native dll?
              It looks like it needs to contain something named "rxtxSerial". I don't see that in your JNLP file; check the RXTX documentation (especially the part about installation or setup) to see if that's mentioned at all.
              • 4. Re: Native library problem
                824073
                It is in my jnlp file, in the native resources part:
                <resources os="Windows" arch="x86">
                   <nativelib href="native/rxtx32.jar"/>
                   <jar href="native/swt32.jar"/>
                </resources>
                The rxtx32.jar contains a dll file called rxtxSerial.dll. I also looked at the rxtx webstart documentation (http://rxtx.qbang.org/wiki/index.php/WebStart), but I do the same as described on that page...
                • 5. Re: Native library problem
                  DrClap
                  Okay. And are you sure that jar is being downloaded? Perhaps your relative URLs aren't right.
                  • 6. Re: Native library problem
                    824073
                    Yes, I'm pretty sure it's being downloaded: if I delete the jar file, the application refuses to load saying it can't find the "rxtx64.jar". If I put it back, the application loads again.
                    I'm wondering if there's something wrong with the jar file, although I followed the simple instructions of placing the dll in the root of the jar file...
                    • 7. Re: Native library problem
                      EJP
                      Post the output of jav tvf rxtx64.jar here.
                      • 8. Re: Native library problem
                        824073
                        Hi,

                        Here is the output:

                        138 Wed Mar 07 13:21:54 CET 2012 META-INF/MANIFEST.MF
                        259 Fri Mar 16 17:26:28 CET 2012 META-INF/TESTALIA.SF
                        1044 Fri Mar 16 17:26:28 CET 2012 META-INF/TESTALIA.DSA
                        128000 Wed Feb 04 20:12:44 CET 2009 rxtxSerial.dll
                        • 9. Re: Native library problem
                          817264
                          1) search deploy cache folder for your all file
                          If native lib jar is handled correctly then all should be unpacked to the filesystem

                          2) use process monitor from sysinternals.com to check where java process looks up for dll in question

                          3) If you can find dll in the deploy cache - run depends.exe on the all file in the cache location and see if there are any unresolved dependencies.

                          Edited by: igor on Apr 8, 2012 11:10 PM
                          • 10. Re: Native library problem
                            824073
                            The dlll file is there: it's present 4 times in the AppData\LocalLow\Sun\Java\Deployment\cache folder, so I'm guessing it's getting unpacked correctly.

                            What do you mean by the "all" file?
                            • 11. Re: Native library problem
                              817264
                              The dlll file is there: it's present 4 times in the AppData\LocalLow\Sun\Java\Deployment\cache folder, so I'm guessing it's getting unpacked correctly.
                              good. That means your jar is likely to be fine and webstart can extract dll.
                              Now you need to find out why it can not be loaded.
                              Try to answer other 2 questions.
                              What do you mean by the "all" file?
                              Sorry. Browser speller "fixed" all occurrences of "dll" to be "all" :)
                              Corrected previous message.
                              • 12. Re: Native library problem
                                824073
                                Ah ok I see what you mean now :-)

                                The only dependency the dll has is the "kernel32.dll", so I don't think that's the problem.

                                If I do a System.out.println of "java.library.path", I get this output:
                                C:\Program Files\Java\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Program Files (x86)\PC Connectivity Solution\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\CollabNet\Subversion Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;E:\java\tools\ec2-api-tools-1.3-57419\bin;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;E:\java\tools\apache-ant-1.8.0\bin;C:\Program Files\TortoiseSVN\bin;C:\tools\mkv\MKVtoolnix;E:\Program Files\Microsoft SDKs\Windows\v7.1\Bin;"C:\Program Files\Java\jre6\bin"

                                It doesn't contain the cache directory with the dll file.

                                I will try the process monitor now, but I have to reboot first.
                                • 13. Re: Native library problem
                                  824073
                                  Looking at the Process Monitor confirms what I thought: it extracts the jar file to the cache, but doesn't look in the cache when trying to load the dll. It looks in all the entries in the "java.library.path", but the cache folder is not in there...
                                  • 14. Re: Native library problem
                                    AndyHerrick
                                    is the call to load the library comming from code loaded by the JNLPClassLoader ? or somehow by system code ?
                                    The findLibrary() call in JNLPClassLoader should find the extracted lib by going thru all the nativelib jars in the jnlp file and checking the expanded directories for files of the given name.

                                    /Andy
                                    1 2 Previous Next