Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1akwYI-0007ty-Un for pgsql-jdbc@arkaria.postgresql.org; Tue, 29 Mar 2016 16:31:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1akwYI-0004wh-9d for pgsql-jdbc@arkaria.postgresql.org; Tue, 29 Mar 2016 16:31:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1akwYH-0004of-7H for pgsql-jdbc@postgresql.org; Tue, 29 Mar 2016 16:31:33 +0000 Received: from smtp618.redcondor.net ([208.80.206.18]) by makus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1akwY8-0006Uf-GD for pgsql-jdbc@postgresql.org; Tue, 29 Mar 2016 16:31:30 +0000 Received: from mailproxy3.av-mx.com ([137.118.40.133]) by smtp618.redcondor.net ({25934d7d-0c4d-4838-a484-2a3cc0768185}) via TCP (outbound) with ESMTP id 20160329163120536_0618; Tue, 29 Mar 2016 16:31:20 +0000 X-RC-FROM: Received: from [192.168.157.52] (unknown [76.75.5.113]) (Authenticated sender: danap@itstriangle.com) by mailproxy3.av-mx.com (Postfix) with ESMTPA id 3A5E6200173; Tue, 29 Mar 2016 12:31:14 -0400 (EDT) Message-ID: <56FAAF8E.1080308@itstriangle.com> Date: Tue, 29 Mar 2016 10:38:38 -0600 From: danap User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Firefox/24.0 SeaMonkey/2.21 MIME-Version: 1.0 To: Nithin Chakravarthi , PostgreSQL JDBC Subject: Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DLP-ENABLED: 137.118.40.128/25 X-MAG-OUTBOUND: greymail.redcondor.net@137.118.40.128/25 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org 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