> Ok, I've had another look through your comments, and I'm a touch
> confused.
My mistake. I meant Class.forName() wherever I mentioned Class.findClass() (I
find Class.forName() a very unintuitive name, and keep substituting a "clearer"
one automatically). My apologies for the confusion.
[from an earlier post]
> I don't know why you think it's impossible to use LoadClass
> directly - the code snippet I gave you was taken directly from my code,
> with variable names changed to protect the innocent.
Again, my mistake -- I was thinking of ClassLoader.findClass() (notice a
pattern here ? ;-).
However, loadClass() is only public in one form (which incidentally, is /not/
the form used as an example in the JavaDoc...) and its other forms (including
its "replacement" findClass()) are documented as intended only for the JVM to
call, or for classloaders to delegate to their superclass implementations. I'm
not sure why loadClass(String) is public. One indication that it probably
shouldn't be is that it doesn't work for loading array classes. I believe that
we are better off avoiding even the public form. YMMV.
[back to the most recent post]
> I also note that you mention something about having these files on the
> classpath. These files will be generated at runtime, and put into a
> dynamically specified directory. Therefore I cannot add this directory
> to the classpath.
I did put the word "classpath" into scare quotes -- to show that I didn't mean
the /real/ classpath. All I meant was the classpath-like sequence of URLs that
each URLClassLoader is configured to search.
-- chris
Lee - 25 Jul 2006 14:33 GMT
> My mistake. I meant Class.forName() wherever I mentioned Class.findClass() (I
> find Class.forName() a very unintuitive name, and keep substituting a "clearer"
> one automatically). My apologies for the confusion.
No worries, I appreciate your assistance!
> However, loadClass() is only public in one form (which incidentally, is /not/
> the form used as an example in the JavaDoc...) and its other forms (including
[quoted text clipped - 3 lines]
> shouldn't be is that it doesn't work for loading array classes. I believe that
> we are better off avoiding even the public form. YMMV.
You are probably right, as I can't get it to work!
> I did put the word "classpath" into scare quotes -- to show that I didn't mean
> the /real/ classpath. All I meant was the classpath-like sequence of URLs that
> each URLClassLoader is configured to search.
~ Aha, right you are then, I did worry for a minute!
I still can't get it to work though, even with your suggestions! I
have a fudgy way to work round the problem at the moment but if you or
anyone has any further suggestions I;d be really grateful.
Cheers Chris and other poster,
Lee.
Chris Uppal - 26 Jul 2006 08:32 GMT
> I still can't get it to work though, even with your suggestions! I
> have a fudgy way to work round the problem at the moment but if you or
> anyone has any further suggestions I;d be really grateful.
If you can describe how your "fudge" differs from the obvious way of doing
this, then it might be possible to guess why the obvious way isn't working.
-- chris
Lee - 27 Jul 2006 11:44 GMT
Cheers for your assistance - I've managed to sort the
NoClassDefFoundError - I think. Some serious testing is needed first!
I do now have a new exception, but I'll come to that in a different
thread if necessary!
Thanks again folks.
Lee.
> > I still can't get it to work though, even with your suggestions! I
> > have a fudgy way to work round the problem at the moment but if you or
[quoted text clipped - 4 lines]
>
> -- chris