piece of cake... just use URLClassLoader, and use "file:" URLs ....
You can obtain automatically the URL using File.toURL() .. but that's only
available on 1.2 forwards
David Maclean <[EMAIL PROTECTED]> on 04/07/2000 10:48:09
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: Re: the java task
On Tue, 4 Jul 2000, Yannick Menager wrote:
>
>
> Couldn't somebody patch that task so that it uses a classloader to loads the
> indicated classpath.
I was looking into the possibility of having dynamic classpaths via a
custom class loader. I am still looking at the feasibility of it. Any
comments/suggestions welcome. I think it is possible. This feature, I
think would be welcome.
I came across a similar problem when I wanted to use Ant to
produce nightly builds by using the Cvs and Ant tasks as well as other
custom tasks that I was writing. The problem was that without forking,
adding to the classpath is not currently possible and some of the
sub-builds required extra classes. To get around it I would have had to
have a copy of all the zip/jar files in the classpath of the master Ant
build. I did not like this. If there was an option for dynamic classpaths
then this would have been trivial as in the Ant sub-build I could have
done something like the following (in the build.xml file):
<classpath>
<path>activation.jar</path>
<path>mail.jar</path>
<path>xerces.jar</path>
</classpath>
>
> I'd do it myself if I had time to breathe :-)
>
>
>
>
>
> Ken Wood <[EMAIL PROTECTED]> on 04/07/2000 04:54:38
>
> Please respond to [EMAIL PROTECTED]
>
> To: [EMAIL PROTECTED]
> cc:
> Subject: Re: the java task
>
>
> That is correct - the classpath in effect at the time you
> do a java task with fork="no" is the classpath that
> Ant was invoked with. You are just running your task
> within the JVM that is running ant. But if you set fork="yes"
> then you are starting a new JVM with the specified args and
> classpath.
>
> "Allen, Michael B (RSCH)" wrote:
>
> > Hello,
> >
> > I'm having a little trouble with the java task. If I have a target like
> > below it doesn't work:
> >
> > 86 <target name="run_http">
> > 87 <java classname="com.sun.jini.tool.ClassServer"
> > 88 fork="no"
> > 89 jvmargs=""
> > 90 classpath="lib/jini1_0_1/lib/tools.jar"
> > 91 args="-dir ${codebase.dir} -port ${codebase.port}"/>
> > 92 </target>
> >
> > [EMAIL PROTECTED] swooshmail]$ ./bin/build run_http
> > Buildfile: etc/build.xml
> > Project base dir set to: /home/miallen/NYU/vjkproj/swooshmail
> > Executing Target: run_http
> >
> > BUILD FATAL ERROR
> >
> > etc/build.xml:91: Could not find com.sun.jini.tool.ClassServer. Make sure
> > you have it in your classpath
> >
> > [EMAIL PROTECTED] swooshmail]$ ls lib/jini1_0_1/lib/
> > jini-core.jar jini-examples.jar mahalo-dl.jar reggie-dl.jar
> > sun-util.jar
> > jini-examples-dl.jar jini-ext.jar mahalo.jar reggie.jar
> > tools.jar
> > [EMAIL PROTECTED] swooshmail]$ echo $CLASSPATH
> > /usr/local/javalibs/classes111.zip
> >
> > But if I change fork="yes" then it does work. So I gather the classpath
> > attribute really has no effect if fork="no" just like the jvm and jvmargs
> > attributes ehh?
> >
> > Thanks,
> >
> > Michael B. Allen
> > [EMAIL PROTECTED]
> > http://jcifs.samba.org - MS Windows File and Print Sharing API in 100% Java
>
>
>
>
>
>
>