1
<!--$Id: conf.so,v 10.18 2001/03/13 20:39:48 bostic Exp $-->
2
<!--Copyright 1997-2001 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
6
<title>Berkeley DB Reference Guide: Configuration</title>
7
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
11
<a name="2"><!--meow--></a>
12
<table width="100%"><tr valign=top>
13
<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Java API</dl></h3></td>
14
<td align=right><a href="../../ref/rpc/server.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/java/compat.html"><img src="../../images/next.gif" alt="Next"></a>
17
<h1 align=center>Configuration</h1>
18
<p>Building the Berkeley DB java classes, the examples and the native support
19
library is integrated into the normal build process. See
20
<a href="../../ref/build_unix/conf.html#--enable-java">Configuring
21
Berkeley DB</a> and <a href="../../ref/build_win/intro.html">Building for Win32</a>
23
<p>We expect that you already installed the Java JDK or equivalent on your
24
system. For the sake of discussion, we assume that it is in a directory
25
called db-VERSION; for example, you downloaded a Berkeley DB archive, and you
26
did not change the top-level directory name. The files related to Java
27
are in two subdirectories of db-VERSION: java (the java source files)
28
and libdb_java (the C++ files that provide the "glue" between java and
29
Berkeley DB). The directory tree looks like this:
30
<p><blockquote><pre> db-VERSION
44
<p>This naming conforms to the emerging standard for naming java packages.
45
When the java code is built, it is placed into a <b>classes</b>
46
subdirectory that is parallel to the <b>src</b> subdirectory.
47
<p>For your application to use Berkeley DB successfully, you must set your
48
CLASSPATH environment variable to include db-VERSION/java/classes as
49
well as the classes in your java distribution. On UNIX, CLASSPATH is
50
a colon-separated list of directories; on Windows, it is separated by
51
semicolons. Alternatively, you can set your CLASSPATH to include
52
db-VERSION/java/classes/db.jar, which is created as a result of the
53
build. The db.jar file contains the classes in com.sleepycat.db; it
54
does not contain any classes in com.sleepycat.examples.
55
<p>On Windows, you will want to set your PATH variable to include
56
<p><blockquote><pre>db-VERSION\build_win32\Release</pre></blockquote>
57
<p>On UNIX, you will want to set the LD_LIBRARY_PATH environment variable
58
to include the Berkeley DB library installation directory. Of course, the
59
standard install directory may have been changed for your site; see your
60
system administrator for details. Regardless, if you get the following
61
exception when you run, you probably do not have the library search path
63
<p><blockquote><pre>java.lang.UnsatisfiedLinkError</pre></blockquote>
64
<p>Different Java interpreters provide different error messages if the
65
CLASSPATH value is incorrect, a typical error is the following:
66
<p><blockquote><pre>java.lang.NoClassDefFoundError</pre></blockquote>
67
<p>To ensure that everything is running correctly, you may want to try a
68
simple test from the example programs in
69
<p><blockquote><pre>db-VERSION/java/src/com/sleepycat/examples</pre></blockquote>
70
<p>For example, the following sample program will prompt for text input
71
lines, which are then stored in a Btree database named "access.db" in
72
your current directory:
73
<p><blockquote><pre>% java com.sleepycat.examples.AccessExample</pre></blockquote>
74
<p>Try giving it a few lines of input text and then end-of-file. Before
75
it exits, you should see a list of the lines you entered display with
76
data items. This is a simple check to make sure the fundamental
77
configuration is working correctly.
78
<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/rpc/server.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/java/compat.html"><img src="../../images/next.gif" alt="Next"></a>
80
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>