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: 1836DA42-89E0-486D-8DB3-A4715AD0F81F@mac.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hello:

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.]
org.postgresql.Driver
java.lang.ClassNotFoundException: org.postgresql.Driver
     at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(Class.java:141)
     at gastos.main(gastos.java:17)

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.

Regards,

Enrique

Responses

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-2014 The PostgreSQL Global Development Group