From: Jan de Visser <jdevisser@digitalfairway.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: I just can't use the org.postgresql.Driver class... Please help!
Date: Wed, 5 Apr 2006 15:02:48 -0400
Message-ID: <200604051502.48358.jdevisser@digitalfairway.com> (raw)
In-Reply-To: <3a829cca0604051153i71f8a212n5992243608f6f2cb@mail.gmail.com>
References: <3a829cca0604051153i71f8a212n5992243608f6f2cb@mail.gmail.com>
On Wednesday 05 April 2006 14:53, Kamal wrote:
> Simple log file making me crazy (javac.log):
>
> JasperReportsTest.java:6: unreported exception
> java.lang.ClassNotFoundException; must be caught or declared to be
> thrown
> Class.forName("org.postgresql.Driver");
> ^
> 1 error
>
> Obviously the file postgresql-8.1-405.jdbc3.jar is there...
>
> Why does it say ClassNotFound if the file is there? Can anyone help me?
> Thank you : )
Well, the class is there at *compile time*. What this is telling you is that
at *runtime* Class.forName() will fail with that exception if the class is
not available *at runtime*. You need to catch the exception, like so:
try {
Class.forName( "org.postgresql.Driver" );
} catch ( ClassNotFoundException cnfe ) {
System.err.println( "driver not found!" );
}
I would recommend an introductory Java text.
jan
--
--------------------------------------------------------------
Jan de Visser jdevisser@digitalfairway.com
Baruk Khazad! Khazad ai-menu!
--------------------------------------------------------------
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: jdevisser@digitalfairway.com
Subject: Re: I just can't use the org.postgresql.Driver class... Please help!
In-Reply-To: <200604051502.48358.jdevisser@digitalfairway.com>
References: <3a829cca0604051153i71f8a212n5992243608f6f2cb@mail.gmail.com> <200604051502.48358.jdevisser@digitalfairway.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