If you want to build the sample applications in this chapter, you will need a Java compiler and a Java runtime environment. If you are using Windows, Linux, or Solaris, you can obtain the Java SDK (software development kit) and runtime environment from Sun Microsystems (http://java.sun.com). For other environments, search the web or contact your vendor.
I'll use a simple makefile to build the JDBC sample applications, so you will need the make utility as well.
Listing 13.1 shows the makefile that I'll use:
# # Filename: makefile # JAVAC = javac JFLAGS = -g .SUFFIXES: .class .java .java.class: $(JAVAC) $(JFLAGS) $<
This makefile states that, to turn a .java (Java source code) file into a .class (Java executable) file, you must run the javac compiler. I like all my applications to be debuggable, so I set JFLAGS to -g (the -g flag tells the compiler to include symbolic debugger information in the .class file); you can replace -g with -O if you want better performance and less debugability.
The last piece that you will need is the PostgreSQL JDBC driver itself. You can find a precompiled version of the PostgreSQL JDBC driver at http://jdbc.postgresql.org. The Java runtime environment will need to know where your driver is located. The driver is typically named postgresql.jar, and the easiest way to tell Java about the driver is to add the jar file's location to the end of your CLASSPATH environment variable. For example, if you are connected to a Unix/Linux host and find postgresql.jar in the /usr/local/pgsql/share directory, execute the following command:
$ export CLASSPATH=$CLASSPATH:/usr/local/pgsql/share/postgresql.jar
If you are connected to a Windows host and find postgresql.jar in the C:\WINDOWS\CLASSES directory, use the following command:
C:\> set CLASSPATH=%CLASSPATH%;C:\WINDOWS\CLASSES\postgresql.jar