head 1.2; access; symbols RPM_4_2_1:1.1.1.5 RPM_4_2:1.1.1.5 RPM_4_1_1:1.1.1.5 RPM_4_1:1.1.1.4 RPM_4_0_5:1.1.1.3 RPM_4_0_4:1.1.1.2 RPM_4_0_3:1.1.1.1 RPM:1.1.1; locks; strict; comment @# @; 1.2 date 2008.01.02.09.55.15; author rse; state dead; branches; next 1.1; commitid z4cpSiAhOCXk5PLs; 1.1 date 2001.07.23.20.45.37; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2001.07.23.20.45.37; author rse; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 2002.01.08.00.30.12; author rse; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 2003.01.18.13.49.02; author rse; state Exp; branches; next 1.1.1.4; 1.1.1.4 date 2001.12.06.00.08.16; author rse; state Exp; branches; next 1.1.1.5; 1.1.1.5 date 2003.01.18.14.05.00; author rse; state Exp; branches; next ; desc @@ 1.2 log @remove the ancient RPM 4.2.1 source tree copy @ text @ Berkeley DB Reference Guide: Configuration

Berkeley DB Reference Guide:
Java API

PrevRefNext

Configuration

Building the Berkeley DB java classes, the examples and the native support library is integrated into the normal build process. See Configuring Berkeley DB and Building for Win32 for more information.

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 two subdirectories of db-VERSION: java (the java source files) and libdb_java (the C++ files that provide the "glue" between java and Berkeley DB). The directory tree looks like this:

		db-VERSION
	       /          \
	    java        libdb_java
	     |              |
	    src            ...
	     |
	    com
	     |
	 sleepycat
	/         \
       db       examples
       |           |
      ...         ...

This naming conforms to the emerging standard for naming java packages. When the java code is built, it is placed into a classes subdirectory that is parallel to the src subdirectory.

For your application to use Berkeley DB successfully, you must set your CLASSPATH environment variable to include db-VERSION/java/classes as well as the classes in your java distribution. On UNIX, CLASSPATH is a colon-separated list of directories; on Windows, it is separated by semicolons. Alternatively, you can set your CLASSPATH to include db-VERSION/java/classes/db.jar, which is created as a result of the build. The db.jar file contains the classes in com.sleepycat.db; it does not contain any classes in com.sleepycat.examples.

On Windows, you will want to set your PATH variable to include

db-VERSION\build_win32\Release

On UNIX, you will want to set the LD_LIBRARY_PATH environment variable 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. Regardless, if you get the following exception when you run, you probably do not have the library search path configured correctly:

java.lang.UnsatisfiedLinkError

Different Java interpreters provide different error messages if the CLASSPATH value is incorrect, a typical error is the following:

java.lang.NoClassDefFoundError

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

db-VERSION/java/src/com/sleepycat/examples

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

% java com.sleepycat.examples.AccessExample

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.

PrevRefNext

Copyright Sleepycat Software @ 1.1 log @Initial revision @ text @d1 1 a1 1 @ 1.1.1.1 log @Import: RPM 4.0.3 @ text @@ 1.1.1.2 log @Import: RPM 4.0.4 @ text @d1 1 a1 1 d6 1 a6 1 Berkeley DB Reference Guide: Java configuration d17 1 a17 1

Java configuration

d44 3 a46 4

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: db.jar, containing the db package, and dbexamples.jar, containing the examples. d48 10 a57 17 CLASSPATH environment variable to include the full pathname of the db jar files as well as the classes in your java distribution. On UNIX, CLASSPATH 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.

The Berkeley DB Java classes are mostly implemented in native methods. Before you can use them, you need to make sure that the DLL or shared library containing the native methods can be found by your Java runtime. On Windows, you should set your PATH variable to include:

db-VERSION\build_win32\Release

On UNIX, you should set the LD_LIBRARY_PATH environment variable or local equivalent d60 3 a62 6 system administrator for details.

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

% java -Djava.library.path=/usr/local/BerkeleyDB/lib ...

Regardless, if you get the following exception when you run, you probably do not have the library search path configured correctly: d65 1 a65 1 CLASSPATH value is incorrect, a typical error is the following: d69 1 a69 1

db-VERSION/java/src/com/sleepycat/examples
d71 1 a71 1 lines, which are then stored in a Btree database named access.db in @ 1.1.1.3 log @Import: RPM 4.0.5 @ text @d1 2 a2 2 a3 1 d14 1 a14 1 PrevRefNext d89 1 a89 1

PrevRefNext @ 1.1.1.4 log @Import: RPM 4.1 @ text @d1 2 a2 2 d4 1 d15 1 a15 1 PrevRefNext d90 1 a90 1

PrevRefNext @ 1.1.1.5 log @Import: RPM 4.1.1 @ text @d1 2 a2 2 a3 1 d14 1 a14 1 PrevRefNext d89 1 a89 1

PrevRefNext @