当前位置:网站首页 > Java教程 > 正文

berkeley db java 教程



We expect that you already installed the Java JDK or equivalent on your system. For the sake of discussion, we assume that it is in a directory called db-VERSION; for example, you downloaded a Berkeley DB archive, and you did not change the top-level directory name. The files related to Java are in three subdirectories of db-VERSION: java (the java source files), libdb_java (the C++ files that provide the “glue” between java and Berkeley DB) and examples/java (containing all examples code). The directory tree looks like this:

This naming conforms to the de facto standard for naming java packages. When the java code is built, it is placed into two jar files: , containing the db package, and , containing the examples.

For your application to use Berkeley DB successfully, you must set your environment variable to include the full pathname of the db jar files as well as the classes in your java distribution. On UNIX, is a colon-separated list of directories and jar files; on Windows, it is separated by semicolons. On UNIX, the jar files are put in your build directory, and when you do the make install step, they are copied to the lib directory of your installation tree. On Windows, the jar files are placed in the Release or Debug subdirectory with your other objects.

On UNIX, you should set the environment variable or local equivalent to include the Berkeley DB library installation directory. Of course, the standard install directory may have been changed for your site; see your system administrator for details.

On other platforms, the path can be set on the command line as follows (assuming the shared library is in :)

Regardless, if you get the following exception when you run, you probably do not have the library search path configured correctly:

To ensure that everything is running correctly, you may want to try a simple test from the example programs in

For example, the following sample program will prompt for text input lines, which are then stored in a Btree database named in your current directory:

Try giving it a few lines of input text and then end-of-file. Before it exits, you should see a list of the lines you entered display with data items. This is a simple check to make sure the fundamental configuration is working correctly.

版权声明


相关文章:

  • java入门经典教程62024-12-01 17:26:05
  • java软件工程师教程2024-12-01 17:26:05
  • java教程在线学堂2024-12-01 17:26:05
  • java菜鸟教程java2024-12-01 17:26:05
  • java版交易墙教程2024-12-01 17:26:05
  • java高级特效教程2024-12-01 17:26:05
  • java2实用教程第4版pdf2024-12-01 17:26:05
  • java技术入门教程2024-12-01 17:26:05
  • socketio教程Java2024-12-01 17:26:05
  • java全套教程图2024-12-01 17:26:05