14 Replies Latest reply: Jan 23, 2008 4:23 PM by 618940 RSS

    unsatisfied link error  with Java API

      Although I've gotten the command-line dbxml working ok, I can't get a Java program to work (even copying others' examples). Using NetBeans, I get this error message:

      UnsatisfiedLinkError: no libdb_java43 in java.library.path

      I am confused by the FAQ entry at http://www.oracle.com/technology/products/berkeley-db/faq/xml_faq.html#24 as well as the instructions at dbxml/docs/ref/build_win/intro.html within the download that says that Java support is not built automatically. Is it just a means of adding something to some path, or do you have to build it even if you use the Windows .msi installer?

      First of all, I thought that the Windows installer would take care of it, no? Anyways, I am confused by the combination of Classpath options both within Windows System variables and as a means to attach to Netbeans projects...

      I'd rather not be dealing with the command line at all Help!!! Remember, I'm new to Java, NetBeans, and even Windows (being a Mac user till recently)...

        • 1. Re: unsatisfied link error  with Java API
          I would recommend getting this to work outside of Netbeans first. Also,
          I just answered a similar question here:

          java.library.path libdb_java44

          Please review the response and if you are still having problems post them here.

          Again do this outside of Netbeans first.

          • 2. Re: unsatisfied link error  with Java API

            Thanks very much for the response, but I still have the problem after reading your other response...

            Actually, in addition to the command line tool for BDBXML, I am able to successfully run the Java examples such as java dbxml.gettingStarted.simpleQuery -h dbEnv (the dbAccess example you gave in the other thread just gave me an "input" command-line which I didn't know how to get out of besides closing the window)--though I still don't understand how I am accessing "dbxml" while I am in the subdirectory (I know the "." must be accessing a method of this class somehow (apparently via the Classpath or Path setting?), but I'm confused about how the syntax works exactly such as to make my own; will my file hierarchy give me a clue somehow and if not how?--I didn't detect any exact pattern).

            Anyways, as I said, I am able to run the Java examples, but when I write my own program in Netbeans (using an example from a book), using these import statements:

            import com.sleepycat.dbxml.*;
            import com.sleepycat.db.*;
            import java.io.*;

            ...I still get the error. I suppose this means that the problem is with my Netbeans configuration? Any ideas how to fix that? I've tried setting what seem to me to be the relevant sections within Netbeans (adding the same files and folders in the System PATH and CLASSPATH--i.e., the jar files under /jar and /bin and /bin/debug (from the main BDB folder)--under Project Properties->Libraries->Compile/Run/Compile Tests/Run Tests), and it doesn't change anything.

            Just in case, here's my Path/Classpath information (that I get from accessing System Properties of "My Computer", then clicking Environment variables in the Advanced tab):

            USER VARIABLE CLASSPATH: C:\Program Files\Java\jre1.5.0_09\lib\ext\QTJava.zip;C:\Program Files\Java\jre1.5.0_09\lib\ext\mysql-connector-java-5.0.4\mysql-connector-java-5.0.4-bin.jar;C:\Berkeley DB XML\jar\dbxml.jar;C:\Berkeley DB XML\jar\db.jar;C:\Berkeley DB XML\jar\dbxmlexamples.jar

            USER VARIABLE PATH: C:\Berkeley DB XML\bin;C:\Berkeley DB XML\bin\debug;C:\Berkeley DB XML\lib


            SYSTEM VARIABLE PATH: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\php;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Program Files\Java\jre1.5.0_09\lib\ext\mysql-connector-java-5.0.4\mysql-connector-java-5.0.4-bin.jar
            • 3. Re: unsatisfied link error  with Java API
              Well it’s good news that you got things to compile and run outside of Netbeans you are almost there.

              What version of Berkeley DB XML are you working with?

              You ran the MSI installer and did you have the installation program set your path and classpath variables?

              What are the contents of :

              C:\Berkeley DB XML\jar\
              C:\Berkeley DB XML\bin;
              C:\Berkeley DB XML\bin\debug;
              C:\Berkeley DB XML\lib

              I do not use Netbeans so you could check on the internet for specific instructions there to make sure you have that covered? Are there specific Netbeans instructions for setting the path?

              In Netbeans did everything compile correctly? These are runtime errors I assume based on the error. Just making sure I understand what you are saying?

              • 4. Re: unsatisfied link error  with Java API
                Again, thanks for sticking with me, here...

                C:\Berkeley DB XML\bin contains "libdb_java45.dll" among many other things
                C:\Berkeley DB XML\bin\debug contains "libdb_java45d.dll" among many other things
                C:\Berkeley DB XML\jar contains "db.jar", "dbexamples.jar", "dbxml.jar", and "dbxmlexamples.jar"
                C:\Berkeley DB XML\lib contains "libdb45.lib", "libdb45d.lib", "libdbxml23.lib", "libdbxml23d.lib", and some files for xerces and xqilla.

                I am running the latest version available at the site, 2.3.8. Yes, I did originally run the MSI Installer and have it set my path and classpath.

                In Netbeans, everything did compile correctly. You're right, it is apparently just a run-time error. There do seem to be specific Netbeans instructions for adding the path, but there are many places to do this. I added the folders, and in the case of the JAR's, the specific files, to the various places where it seemed logical to add them (under the subwindows of "Project Properties"->Libraries for my particular project). I guess I may need to post my question on a Java or another Netbeans forum--but if it is not just me being dense, given that Netbeans is Sun's own IDE, I imagine this problem might crop up for others here too, especially if it is due to some interaction between the two. If I find out from the Java/Netbeans list, I can share it over here.

                Thanks very much for your help,
                best wishes,
                • 5. Re: unsatisfied link error  with Java API
                  Ok, as the Chinese expression goes, I've hit the target but don't know why. :)

                  It's working now, though I don't know what I did differently.

                  As far as Netbeans, (I had tried this before, so I'm not sure what I did differently) what one must do to get it to compile and run successfully is go to Project Properties (right-click your project and go to "Properties" to get there), then choose "Libraries" then the Compile tab. Then cilck to "Add JAR/folder" and add all the files under the \jar subdirectory of your main Berkeley DB directory (I recall reading that setting the files in this compile tab will also make it available to Run, etc., so I imagine that is why I don't get any run-time errors without having added files/directories to the 'Run' or other tabs).

                  Additional tip for a real noobie like myself: the File object doesn't make a file or directory in Java, so you better have that file or directory already existing.

                  • 6. Re: unsatisfied link error  with Java API
                    Hi Brett,

                    I'm glad all is working now.

                    Thanks for posting this info about Netbeans to share with others.

                    • 7. Re: unsatisfied link error  with Java API
                      Hi Ron

                      I have exactly the same error using JDeveloper !

                      I jar was included as library in the project properties.
                      The classpath and path are correct.

                      My application compile but i got a run time error :
                      Exception in thread "main" java.lang.UnsatisfiedLinkError: no libdb_java45 in java.library.path

                      libdb_java45.dll in <home>/bin directory. The path is correct. May be i have to force JDeveloper to know about this directory ?
                      • 8. Re: unsatisfied link error  with Java API
                        You probably do have to let JDeveloper know. In general, most application servers and Java development environments seem to be very careful about not using any state from your own environment, but instead rely on explicit settings (which are tool-dependent).


                        • 9. Re: unsatisfied link error  with Java API
                          Thanks i added it as a library in jdev and it is working fine now.
                          • 10. Re: unsatisfied link error  with Java API
                            I am having this same problem running Windows XP and JCreator.

                            My error message is:

                            Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files\Oracle\Berkeley DB XML 2.3.10\bin\libdbxml_java23.dll: The specified procedure could not be found
                            at java.lang.ClassLoader$NativeLibrary.load(Native Method)
                            at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
                            at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
                            at java.lang.Runtime.loadLibrary0(Runtime.java:823)
                            at java.lang.System.loadLibrary(System.java:1030)
                            at com.sleepycat.dbxml.dbxml_javaJNI.<clinit>(dbxml_javaJNI.java:35)
                            at com.sleepycat.dbxml.XmlManager.<init>(XmlManager.java:51)
                            at Test.createDatabase(Test.java:93)
                            at Test.main(Test.java:109)

                            I have the class path set in JCreator for db.jar and dbxml.jar. My environment classpath reads as follows:

                            C:\Program Files\Java\jdk1.6.0_04\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Internet Explorer;;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\MATLAB\R2007b\bin;C:\Program Files\MATLAB\R2007b\bin\win32;C:\Program Files\Oracle\Berkeley DB XML 2.3.10\bin

                            Any ideas to overcome this runtime error? Thanks.
                            • 11. Re: unsatisfied link error  with Java API
                              Have you tried adding the jars to your CLASSPATH environment variable, such as C:\Program Files\Oracle\Berkeley DB XML 2.3.10\jar\dbxml.jar?

                              Lauren Foutz
                              • 12. Re: unsatisfied link error  with Java API
                                Yes I have done that. I know that the jars are being found because it is compiling. The problem is that it is not finding the dlls... but I have included the bin directory for the Berkeley DB XML in the classpath. I cannot figure out why they are not being resolved at runtime.
                                • 13. Re: unsatisfied link error  with Java API
                                  The bin (or bin/debug) directory needs to be in your PATH
                                  CLASSPATH is only for the .jar files.

                                  Regards, George
                                  • 14. Re: unsatisfied link error  with Java API
                                    Hey!! that worked perfectly. Thanks a lot!