Like so
class = createObject("java", "java.lang.Class");
class.forName("macromedia.jdbc.MacromediaDriver");
or
createObject("java", "java.lang.Class").forName("
macromedia.jdbc.MacromediaDriver");
On 7/18/06, Brad Wood <[EMAIL PROTECTED]> wrote:
>
> I'm not familiar with forName(). How is it used?
>
> ~Brad
>
> -----Original Message-----
> From: Dan Plesse [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 18, 2006 4:42 PM
> To: CF-Talk
> Subject: Re: check for class before creation
>
> forName() might be better because its faster to report the error. I
> think
> createObject takes
> longer.
>
> On 7/18/06, Brad Wood <[EMAIL PROTECTED]> wrote:
> >
> > What if I did a cfdirectory and simply looked for the seefusion.jar
> > file? That would probably work, but I don't know if that is bad form
> > from a programming perspective.
> >
> > ~Brad
> >
> > -----Original Message-----
> > From: Dawson, Michael [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, July 18, 2006 1:36 PM
> > To: CF-Talk
> > Subject: RE: check for class before creation
> >
> > In this case, I would either use try/catch, or have a "settings" file,
> > on each web server, that is checked before you try to create that
> > object.
> >
> > The code would be the same, but the settings file would have a
> > true/false for the existence of the java class, for that particular
> > server.
> >
> > -----Original Message-----
> > From: Brad Wood [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, July 18, 2006 1:19 PM
> > To: CF-Talk
> > Subject: check for class before creation
> >
> > Is there a way to check for existence of a Java class BEFORE I try to
> > create an instance of it with createObject()?
> >
> >
> >
> > I don't want to try/catch it, but I can if I must.
> >
> >
> >
> > In case you are wondering, we have multiple production servers, and
> > SeeFusion is only installed on one of them. As a practice we always
> > keep the code bases consistent across all the servers, but the
> following
> > code of course would error on the servers where SeeFusion is not
> > installed:
> >
> >
> >
> > <cfset seefusion = createObject("java", "com.seefusion.SeeFusion")>
> >
> > <cfset seefusion.setRequestName(cgi.script_name & "?" & form_vars)>
> >
> >
> >
> > Thanks!
> >
> >
> >
> > ~Brad
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:247012
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4