From: danap <danap@itstriangle.com>
To: Nithin Chakravarthi <nithin@embdestech.co.in>
To: PostgreSQL JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver
Date: Tue, 29 Mar 2016 10:38:38 -0600
Message-ID: <56FAAF8E.1080308@itstriangle.com> (raw)
In-Reply-To: <CAE3Q90zo6SngbxbKOVa+tvtot21ioYWd3N_YCz_S+FN9ZZC8ug@mail.gmail.com>
References: <CAE3Q90zo6SngbxbKOVa+tvtot21ioYWd3N_YCz_S+FN9ZZC8ug@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
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: danap@itstriangle.com, nithin@embdestech.co.in
Subject: Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver
In-Reply-To: <56FAAF8E.1080308@itstriangle.com>
References: <CAE3Q90zo6SngbxbKOVa+tvtot21ioYWd3N_YCz_S+FN9ZZC8ug@mail.gmail.com> <56FAAF8E.1080308@itstriangle.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