Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 83DC96351D4 for ; Sat, 27 Feb 2010 21:54:11 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 65552-08-2 for ; Sun, 28 Feb 2010 01:53:51 +0000 (UTC) Received: from news.hub.org (news.hub.org [200.46.204.72]) by mail.postgresql.org (Postfix) with ESMTP id B948E635D0B for ; Sat, 27 Feb 2010 21:53:51 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.3/8.14.3) with ESMTP id o1S1rjlF079297 for ; Sat, 27 Feb 2010 21:53:45 -0400 (AST) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.3/8.14.3/Submit) id o1S1ZOQr074531 for pgsql-jdbc@postgresql.org; Sat, 27 Feb 2010 21:35:24 -0400 (AST) (envelope-from news) From: Lew X-Newsgroups: pgsql.interfaces.jdbc Subject: Re: path and classpath settings Date: Sat, 27 Feb 2010 20:35:30 -0500 Organization: albasani.net Lines: 39 Message-ID: References: <4eb297411002250011i3171f196xffd3297f5fd5fb6b@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@albasani.net X-User-ID: +hubikozqrwtOZ4s8LBgWfm+02yYIgtB5fcR3hYmT6E= In-Reply-To: <4eb297411002250011i3171f196xffd3297f5fd5fb6b@mail.gmail.com> Cancel-Lock: sha1:foYV6FbI0rbCXiKQ/t6CNQcP/MI= User-Agent: Thunderbird 2.0.0.23 (X11/20090817) X-NNTP-Posting-Host: BaNAbZ1WFVve9pq2+X5+FfQRE9feSssMZvCCY8DkNJs= To: pgsql-jdbc@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=-10 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 201002/53 X-Sequence-Number: 20340 shilpa r wrote: > am working on postgreSQL > i [sic] wanted to know the path and CLASSPATH settings on the environbment > variable of Xp For JDBC, the PATH environment variable ("envar") is not relevant. While you can include the PostgreSQL JDBC JAR file in the CLASSPATH, for most purposes that is too much. The CLASSPATH envar affects every Java program that doesn't override it, including in your case any that do not really need the Postgres JDBC JAR. Much better would be to use the "-classpath" or equivalent "-cp" option to the "java" command line, or the equivalent if you are using an application server like Tomcat or Glassfish. You should read up on the document for how to set the classpath for a program within your environment, e.g., through the tutorials and other documentation at java.sun.com. > as am stuck up with an error stating ClassNotFoundException > when am trying to connect to Database thru an java [sic] code Do you have the JDBC JAR on your system? If not, it's available from After that, it's a matter of including it in the classpath the same way you would any other library JAR: ordinary command line: "-cp" as stated above using "java -jar": in a directory relative to the application's JAR and specified by that main JAR's manifest. (Using "java -jar" the JVM ignores any CLASSPATH or "-classpath" specifications.) Deploying to an application server: In the "WEB-INF/lib/" directory of the WAR or the equivalent for an EAR. It is a powerful thing to know how to specify the classpath for a Java program. -- Lew