From: enrique.ibarra@mac.com
To: pgsql-jdbc@postgresql.org
Subject: Problems loading the driver
Date: Fri, 24 Jun 2005 23:41:03 -0500
Message-ID: <1836DA42-89E0-486D-8DB3-A4715AD0F81F@mac.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: enrique.ibarra@mac.com
Subject: Re: Problems loading the driver
In-Reply-To: <1836DA42-89E0-486D-8DB3-A4715AD0F81F@mac.com>
References: <1836DA42-89E0-486D-8DB3-A4715AD0F81F@mac.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox