> Why not just use Class.forName(classNameFromApplet)? Or are you
> trying to load unknown classes across the net? If the classes are
> in the servlet engine's classpath or in the servlets directory, you
> don't need a URLClassloader.
>
>Rod McChesney, Korobra
Ultimately, yes, I'd like to make it possible for the Solvers to be anywhere
across our campus network. (This "Dispatcher" I refer to is part of a
system to aid professors in making web based (applet) homework problems.
The "Solvers" of these problems should not be distributed with the applets,
lest someone dissect their byecodes and distribute the solutions. The
Dispatcher will handle networking and security, so all the profs have to
worry about is their hwk problem and a GUI to present it with.)
On the other hand, is it signifigantly more efficient or secure to do it in
the way you describe? I can easily compromise here, just thought I take
advantage of the apparent versatility of the URLClassLoader.
>If you load class Foo in one class loader it's not the same as class
>Foo loaded by a different class loader. Both their names are Foo,
>but they live in different namespaces and can't be cast to each other.
>I suspect you're loading two versions of Solver.
>Jason Hunter
You're right. I've just put all of the class definitions into the JRE
instead and the problem is solved. (I used to have the Solver class file in
the servlet directory, the applet directory, and the Solver directory.) The
question I now have is this: As I say above, ultimately I'd like it to be
possible for there to be classes extending Solver anywhere, not just on my
own server (where my test Solver currently is.) Thus, another server will
not have the parent class, Solver, in it's JRE. Will I still be able to
load and instantiate the class in that case?
>Your problem might be a fundamental misunderstanding of how classloaders
>work. I recommend you read Shiang Leng's and Bracha's paper on
>loaders, see http://java.sun.com/people/gbracha/classloaders.ps
>
>- Godmar
This is quite likely. I know little to nothing about this. I saw an
example of URLClassLoader in a book and it sounded like it would accomplish
what I wanted, so I tried to use it myself. I haven't actually spent any
time reading the "correct" way to do this stuff, but I guess it's
signifigantly deeper than I thought. (I'm not a real Programmer by a
longshot.) I will read this article.
Thanks everyone!
--
John Brecht
Department of Physics and Astronomy
Michigan State University
[EMAIL PROTECTED]
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html