<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Setting up the Class Path</title><meta content="DocBook XSL Stylesheets V1.78.1" name="generator"><link rel="home" href="index.html" title="The PostgreSQL™ JDBC Interface"><link rel="up" href="setup.html" title="Chapter 2. Setting up the JDBC Driver"><link rel="prev" href="setup.html" title="Chapter 2. Setting up the JDBC Driver"><link rel="next" href="prepare.html" title="Preparing the Database Server for JDBC"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">Setting up the Class Path</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="setup.html">Prev</a> </td><th align="center" width="60%">Chapter 2. Setting up the <acronym class="acronym">JDBC</acronym> Driver</th><td align="right" width="20%"> <a accesskey="n" href="prepare.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="classpath"></a>Setting up the Class Path</h2></div></div></div><a name="N10092" class="indexterm"></a><a name="N10097" class="indexterm"></a><p> To use the driver, the JAR archive (named <code class="filename">postgresql.jar</code> if you built from source, otherwise it will likely be named with the following convention: <code class="filename">postgresql-<em class="replaceable"><code>[server version]</code></em>.<em class="replaceable"><code>[buildnumber]</code></em>.jdbc<em class="replaceable"><code>[JDBC version]</code></em>.jar</code>, for example <code class="filename">postgresql-8.0-310.jdbc3.jar</code>) needs to be included in the class path, either by putting it in the <code class="envar">CLASSPATH</code> environment variable, or by using flags on the <span class="command"><strong>java</strong></span> command line. </p><p> For instance, assume we have an application that uses the <acronym class="acronym">JDBC</acronym> driver to access a database, and that application is installed as <code class="filename">/usr/local/lib/myapp.jar</code>. The <span class="productname">PostgreSQL</span>™ <acronym class="acronym">JDBC</acronym> driver installed as <code class="filename">/usr/local/pgsql/share/java/postgresql.jar</code>. To run the application, we would use: </p><pre class="programlisting"> export CLASSPATH=/usr/local/lib/myapp.jar:/usr/local/pgsql/share/java/postgresql.jar:. java MyApp </pre><p> </p><p> Loading the driver from within the application is covered in <a class="xref" href="use.html" title="Chapter 3. Initializing the Driver">Chapter 3, <i>Initializing the Driver</i></a>. </p></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="setup.html">Prev</a> </td><td align="center" width="20%"><a accesskey="u" href="setup.html">Up</a></td><td align="right" width="40%"> <a accesskey="n" href="prepare.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">Chapter 2. Setting up the <acronym class="acronym">JDBC</acronym> Driver </td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%"> Preparing the Database Server for <acronym class="acronym">JDBC</acronym></td></tr></table></div></body></html>