Yes, that is the way I had it coded originally. I strung it out the way you
saw in my post in order to isolate the problem.
I have tried posting this to the servlet-interest group at Sun. I was not
aware it existed until jon mentioned it in a recent post. (I hate trying to
dig around for things at Sun's site if I don't know where they are ahead of
time since it's always so slow, so I hadn't searched therefor a servlet
interest group before.)
John Brecht
Department of Physics and Astronomy
Michigan State University
[EMAIL PROTECTED]
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: 'Java Apache Users' <[EMAIL PROTECTED]>
Sent: Tuesday, May 04, 1999 5:06 PM
Subject: RE: Class casting problem...
> > Object theInstance = solverClass.newInstance();
>
> Oops I didn't notice the above
>
> have you tried:
>
> Class solverClass;
> solverClass = loader.loadClass(solverName);
> Solver theSolver = null;
> try {
> theSolver = (Solver)solverClass.newInstance();
> }
> catch (Exception e){ // more better exceptions available
> log("couldn't cast, not a Solver!");
> }
> return theSolver;
>
> ***********************************************************
> Brett Knights 626-432-5767 work
> [EMAIL PROTECTED] 626-355-1017 home
> ***********************************************************
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of
> > John Brecht
> > Sent: Tuesday, May 04, 1999 12:22 PM
> > To: Java Apache Users
> > Subject: Re: Class casting problem...
> >
> >
> > I'm pretty ignorant about this myself.
> >
> > I tried your suggestion and it doesn't compile:
> >
> > Error(202): method
> > checkAttempt(edu.msu.lite.JHomework.Attempt, int) not
> > found in class java.lang.Object
> >
> >
> >
> > John Brecht
> > Department of Physics and Astronomy
> > Michigan State University
> > [EMAIL PROTECTED]
> >
> >
> >
> > > > theSolver = (Solver)(theInstance);
> > >
> > > Forgive my ignorance but why are you doing an explicit upcast?
> > > I thought that sort of thing wasn't necessary in Java.
> > > Why can't you make a direct call:
> > >
> > > theInstance.checkAttempt();
> > >
> > > ?
> > >
> > > ***********************************************************
> > > Brett Knights 626-432-5767 work
> > > [EMAIL PROTECTED] 626-355-1017 home
> > > ***********************************************************
> > >
> > >
> > >
> > >
> > > ----------------------------------------------------------------
> > > To subscribe: [EMAIL PROTECTED]
> > > To unsubscribe: [EMAIL PROTECTED]
> > > READ THE FAQ!!!! <http://java.apache.org/faq/>
> > > Archives and Other: <http://java.apache.org/main/mail.html/>
> > > Problems?: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> >
> > ----------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> > READ THE FAQ!!!! <http://java.apache.org/faq/>
> > Archives and Other: <http://java.apache.org/main/mail.html/>
> > Problems?: [EMAIL PROTECTED]
> >
> >
>
>
> ----------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> READ THE FAQ!!!! <http://java.apache.org/faq/>
> Archives and Other: <http://java.apache.org/main/mail.html/>
> Problems?: [EMAIL PROTECTED]
>
>
----------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
READ THE FAQ!!!! <http://java.apache.org/faq/>
Archives and Other: <http://java.apache.org/main/mail.html/>
Problems?: [EMAIL PROTECTED]