Re: pgsql-jdbc and Java

From: abdelkader belkadi <contactbelkadi(at)yahoo(dot)fr>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: pgsql-jdbc and Java
Date: 2005-08-04 08:12:12
Message-ID: 20050804081212.37219.qmail@web25706.mail.ukl.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


I stored my driver in the lib directory of the JDK.

but I manually moved the driver packages in the packages tree of my IDE, and it seems to be working correctly.

Thanks.

Oliver Jowett <oliver(at)opencloud(dot)com> a écrit :
abdelkader belkadi wrote:

> D:\java -jar projectpath/projectname.jar
> the following error is generated:
> Class not found !
> java.lang.ClassNotFoundException: org.postgresql.Driver

> The error disapears if I don't call the method that connects to the
> database, which means that their is no CLASSPATH problem.

A ClassNotFoundException means you *do* have a classpath problem,
whether you like it or not. That exception means that the JVM cannot
find the PostgreSQL JDBC driver class, i.e. it's not in the classpath.

Using -jar has the unexpected behaviour that it makes the JVM completely
ignore any CLASSPATH environment setting. So unless projectname.jar
includes the postgresql driver itself, or references it via manifest
Class-Path, this isn't going to work.

Try an explicit classname and classpath (that includes both the driver
jar and projectname.jar) instead of using -jar.

(also, doesn't the win32/dos JVM expect paths in backslash form? you've
got forward slashes above)

-O


---------------------------------
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez le ici !

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mahesh Shinde 2005-08-04 13:46:48 Help needed
Previous Message Oliver Jowett 2005-08-04 00:17:09 Re: some improve JDBC