Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver

From: danap <danap(at)itstriangle(dot)com>
To: Nithin Chakravarthi <nithin(at)embdestech(dot)co(dot)in>, PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver
Date: 2016-03-29 16:38:38
Message-ID: 56FAAF8E.1080308@itstriangle.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Nithin Chakravarthi wrote:
> Hi All,
>
> I am working on java project to insert and fetch data from postgresql database.
> While using jbdc I am getting error
>
> "*java.lang.ClassNotFoundException: org.postgresql.Driver
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>
> ~
> ~
> ~
>
> //DriverManager.register(org.postgresql.Driver());
> ServerMain.conn =
> DriverManager.getConnection(DB_URL,password);
>
> "
> *
> I have exported class path as
>
> *"export CLASSPATH=./Server.jar:~/Downloads/postgresql-9.3-1103.jdbc3.jar"
> *
>
> Server.jar is main executable file.
>
> So please help me to solve this issue.
> //
> Thanks & Regards,
> *M. Nithin Chakravrthi*
> Software Engineer

Hello Nithin,

Yes you can use Maven or other to build your jar or can
use the basics which is valuable in understanding the
process by compiling directly, and creating the jar
with the commands, javac, jar. Insure these are on your
execution path.

See Example Files:

https://github.com/danap/myjsqlview

make, build, myjsqlview.mf

make - Compiles your source files to the specified directly.
Use the -classpath to defines libraries, jars, required
in the compile.

build - Creates your jar file with included jars, your case
and other files.

myjsqlview.mf - specifiy the inclusion here the main class and
required jar, postgresql driver here.

Use the .bat files for Win, .sh for Unix/Linux.

Alternative, just place the postgresql driver in the jre/lib/ext
folder.

danap.

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message M. Dietrich 2016-03-29 19:16:10 Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver
Previous Message Álvaro Hernández Tortosa 2016-03-29 11:13:19 Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver