Re: pgsql-jdbc and Java

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: pgsql-jdbc and Java
Дата
Msg-id 42F15BC2.9000509@opencloud.com
обсуждение исходный текст
Ответ на pgsql-jdbc and Java  (abdelkader belkadi <contactbelkadi@yahoo.fr>)
Ответы Re: pgsql-jdbc and Java  (abdelkader belkadi <contactbelkadi@yahoo.fr>)
Список pgsql-jdbc
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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: some improve JDBC
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: some improve JDBC