1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <title>Building the Java API</title> 7 <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> 9 <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" /> 10 <link rel="up" href="build_win.html" title="Chapter��28.�� Building Berkeley DB for Windows" /> 11 <link rel="prev" href="win_build_stl.html" title="Building the C++ STL API" /> 12 <link rel="next" href="build_win_csharp.html" title="Building the C# API" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Building the Java API</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="win_build_stl.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��28.�� 23 Building Berkeley DB for Windows 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="build_win_csharp.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="build_win_java"></a>Building the Java API</h2> 35 </div> 36 </div> 37 </div> 38 <div class="toc"> 39 <dl> 40 <dt> 41 <span class="sect2"> 42 <a href="build_win_java.html#id1632327">Building Java with Visual C++ .NET or above</a> 43 </span> 44 </dt> 45 <dt> 46 <span class="sect2"> 47 <a href="build_win_java.html#id1632460">Building Java with Visual C++ 6.0</a> 48 </span> 49 </dt> 50 </dl> 51 </div> 52 <p>Java support is not built automatically. The following instructions 53assume that you have installed the Sun Java Development Kit in 54<code class="filename">d:\java</code>. Of course, if you installed elsewhere or have 55different Java software, you will need to adjust the pathnames 56accordingly.</p> 57 <div class="sect2" lang="en" xml:lang="en"> 58 <div class="titlepage"> 59 <div> 60 <div> 61 <h3 class="title"><a id="id1632327"></a>Building Java with Visual C++ .NET or above</h3> 62 </div> 63 </div> 64 </div> 65 <div class="orderedlist"> 66 <ol type="1"> 67 <li>Set your include directories. Choose <span class="emphasis"><em>Tools -> Options 68-> Projects -> VC++ Directories</em></span>. Under the "Show 69directories for" pull-down, select "Include files". Add the full 70pathnames for the <code class="filename">d:\java\include</code> and 71<code class="filename">d:\java\include\win32</code> directories. Then click OK. These are 72the directories needed when including jni.h.</li> 73 <li>Set the executable files directories. Choose <span class="emphasis"><em>Tools -> 74Options -> Projects -> VC++ Directories</em></span>. Under the "Show 75directories for" pull-down, select "Executable files". Add the full 76pathname for the <code class="filename">d:\java\bin</code> directory, then click OK. 77This is the directory needed to find javac.</li> 78 <li>Set the build type to Release or Debug in the drop-down on the 79tool bar.</li> 80 <li> 81 <p> 82 To build, right-click on db_java and select Build. This builds the 83 Java support library for Berkeley DB and compiles all the java files, 84 placing the resulting <code class="filename">db.jar</code> and 85 <code class="filename">dbexamples.jar</code> files in one of the following 86 Berkeley DB subdirectories, depending on the configuration that you chose: 87</p> 88 <table class="simplelist" border="0" summary="Simple list"> 89 <tr> 90 <td> 91 <code class="filename">build_windows\Win32\Debug</code> 92 </td> 93 </tr> 94 <tr> 95 <td> 96 <code class="filename">build_windows\Win32\Release</code> 97 </td> 98 </tr> 99 </table> 100 </li> 101 </ol> 102 </div> 103 </div> 104 <div class="sect2" lang="en" xml:lang="en"> 105 <div class="titlepage"> 106 <div> 107 <div> 108 <h3 class="title"><a id="id1632460"></a>Building Java with Visual C++ 6.0</h3> 109 </div> 110 </div> 111 </div> 112 <div class="orderedlist"> 113 <ol type="1"> 114 <li>Set the include directories. Choose <span class="emphasis"><em>Tools -> Options 115-> Directories</em></span>. Under the "Show directories for" pull-down, 116select "Include files". Add the full pathnames for the 117<code class="filename">d:\java\include</code> and <code class="filename">d:\java\include\win32</code> directories. 118These are the directories needed when including <code class="filename">jni.h</code>.</li> 119 <li>Set the executable files directories. Choose <span class="emphasis"><em>Tools -> 120Options -> Directories</em></span>. Under the "Show directories for" 121pull-down, select "Executable files". Add the full pathname for the 122<code class="filename">d:\java\bin</code> directory. This is the directory needed to 123find javac.</li> 124 <li>Go to <span class="emphasis"><em>Build -> Set Active Configuration</em></span> and 125select either the Debug or Release version of the db_java project. Then 126press OK.</li> 127 <li> 128 <p> 129 To build, select <span class="emphasis"><em>Build -> Build 130 libdb_java48.dll</em></span>. This builds the Java support 131 library for Berkeley DB and compiles all the java files, placing 132 the resulting <code class="filename">db.jar</code> and 133 <code class="filename">dbexamples.jar</code> files in one of the following 134 Berkeley DB subdirectories, depending on the configuration that you chose: 135 </p> 136 <table class="simplelist" border="0" summary="Simple list"> 137 <tr> 138 <td> 139 <code class="filename">build_windows\Win32\Debug</code> 140 </td> 141 </tr> 142 <tr> 143 <td> 144 <code class="filename">build_windows\Win32\Release</code> 145 </td> 146 </tr> 147 </table> 148 </li> 149 </ol> 150 </div> 151 <p>To run Java code, set your environment variable <code class="literal">CLASSPATH</code> 152to include the full pathname of these jar files, and your environment 153variable <code class="literal">PATH</code> to include the <code class="filename">build_windows\Win32\Release</code> 154subdirectory. On Windows, remember that files or directories in the 155<code class="literal">CLASSPATH</code> and <code class="literal">PATH</code> variables must be 156separated by semicolons (unlike UNIX). Then, try running the following command 157as a test:</p> 158 <pre class="programlisting">java db.AccessExample</pre> 159 <p>If you want to run Java code using a Debug build, substitute 'Debug' 160for 'Release' in the instructions above. Make sure you use the Debug 161JAR file with the Debug DLL and the Release JAR with the Release 162DLL.</p> 163 </div> 164 </div> 165 <div class="navfooter"> 166 <hr /> 167 <table width="100%" summary="Navigation footer"> 168 <tr> 169 <td width="40%" align="left"><a accesskey="p" href="win_build_stl.html">Prev</a>��</td> 170 <td width="20%" align="center"> 171 <a accesskey="u" href="build_win.html">Up</a> 172 </td> 173 <td width="40%" align="right">��<a accesskey="n" href="build_win_csharp.html">Next</a></td> 174 </tr> 175 <tr> 176 <td width="40%" align="left" valign="top">Building the C++ STL API��</td> 177 <td width="20%" align="center"> 178 <a accesskey="h" href="index.html">Home</a> 179 </td> 180 <td width="40%" align="right" valign="top">��Building the C# API</td> 181 </tr> 182 </table> 183 </div> 184 </body> 185</html> 186