>>>>> Is it possible for a java app to change it's classpath at runtime. I
>>>>> tried:
[quoted text clipped - 14 lines]
> classpath.... so the question remains if I do the code in my previous
> post will it now load from the class path or from "foo".
On Oct 24, 9:31 pm, Arne Vajh?j <a...@vajhoej.dk> wrote:
> > On Oct 24, 9:13 pm, Arne Vajh?j <a...@vajhoej.dk> wrote:
> >>> On Oct 24, 8:16 pm, Arne Vajh?j <a...@vajhoej.dk> wrote:
[quoted text clipped - 22 lines]
>
> You need to get those classes of the classpath.
Since this is for a commercial unit testing product this is not
possible in practice (it is not safe to make assumptions about where
people place things). Some one off line suggested forking a process
to do it.... if I can't find a ClassLoader based solution I will have
to do that but it is down right a) not portable b) evil
Daniel Pitts - 25 Oct 2007 05:29 GMT
>>>>>>> Is it possible for a java app to change it's classpath at runtime. I
>>>>>>> tried:
[quoted text clipped - 24 lines]
> to do it.... if I can't find a ClassLoader based solution I will have
> to do that but it is down right a) not portable b) evil
Hmm, I think as a publisher of said software, you can say how it should
work. If you can't make any assumptions whatsoever then you're lost.
You'll end up writing this program for clients who want to be able to
bounce a network signal off the moon for some reason.
It's all about making reasonable assumptions. It is reasonable to
assume that you can have a degree of control the environment/context in
which your application starts up. Document the fact that the code to be
tested can't be in the same path as your product.
Also, you seem to make a big deal about this code being "commercial".
This rule applies for any publicly distributed product, whether
commercial or otherwise.
Honestly, I think you're going down the wrong road with this. Have you
looked at other existing test frameworks? What is yours going to offer
that, say, JUnit doesn't?

Signature
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
Arne Vajhøj - 27 Oct 2007 03:50 GMT
>>>>>>> Is it possible for a java app to change it's classpath at runtime. I
>>>>>>> tried:
[quoted text clipped - 24 lines]
> to do it.... if I can't find a ClassLoader based solution I will have
> to do that but it is down right a) not portable b) evil
You do not have any control over where people put their stuff,
but you have control over your stuff.
If the only thing in classpath is your jar file, then you can
create your own classloader for their stuff and unload and reload
as needed.
Arne