Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver - Mailing list pgsql-jdbc

From danap
Subject Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver
Date
Msg-id 56FAAF8E.1080308@itstriangle.com
Whole thread Raw
In response to Error:java.lang.ClassNotFoundException: org.postgresql.Driver  (Nithin Chakravarthi <nithin@embdestech.co.in>)
List 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.






pgsql-jdbc by date:

Previous
From: John R Pierce
Date:
Subject: Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver
Next
From: "M. Dietrich"
Date:
Subject: Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver