Skip site navigation (1) Skip section navigation (2)

Problems loading the driver

From: enrique(dot)ibarra(at)mac(dot)com
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Problems loading the driver
Date: 2005-06-25 04:41:03
Message-ID: (view raw or whole thread)
Lists: pgsql-jdbc

I am trying to compile a very simple Java J2SE program that will  
connect to a Postgres database. I am using:
* an Apple computer running Mac OS/X 10.4
* Postgres 8.0
* JDBC driver postgresql-8.0-311.jdbc3.jar

The JDBC jar file IS in the CLASSPATH environment variable. The code  
of the program is the following:

     public static void main (String[] args) {

         try {
             Class.forName ("org.postgresql.Driver");
         } catch (ClassNotFoundException e) {
             System.out.println (e.getMessage ());
             e.printStackTrace ();

The program compiles fine but the error message I get when I run the  
program is the following:

[Session started at 2005-06-24 23:32:14 -0500.]
java.lang.ClassNotFoundException: org.postgresql.Driver
     at Method)
     at java.lang.ClassLoader.loadClass(
     at sun.misc.Launcher$AppClassLoader.loadClass(
     at java.lang.ClassLoader.loadClass(
     at java.lang.ClassLoader.loadClassInternal(
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(
     at gastos.main(

I have tried placing the JDBC jar file at different directories while  
adjusting the CLASSPATH variable but I keep getting the same annoying  
error. I also tried the -cp flag when invoking 'java' to execute the  
program, but it does not work. I ran out of ideas and the exercise is  
becoming very frustrating. Any suggestions will be highly  
appreciated. Thanks a lot in advance.




pgsql-jdbc by date

Next:From: Oliver JowettDate: 2005-06-25 05:02:45
Subject: Re: Problem with Async (multiple) notifications
Previous:From: Tom LaneDate: 2005-06-25 04:14:25
Subject: Re: Problem with Async (multiple) notifications

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group