ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Inger <>
Subject Re: Windows cmd line length problems
Date Mon, 15 Oct 2001 19:46:57 GMT
If this is indeed, a problem with the command line length,
then try to refer to the files with a relative path if you
can.   in worst case, you can write your own customer 
classloader that would look for some system property, and
then look in the directory indicated by that, and load all
the classes that you need from that classloader.  It's a
pain because you will have to explicitly have to load
each class, and it's a coding solution, but nonetheless,
it will work.  I don't claim to be an expert on classloaders,
and maybe someone here could help you more on how to
bootstrap the vm so you can use this classloader as the
default (note that it uses the system classloader as
it's parent, so it will pay attention to the system
CLASSPATH if it can't directly find the class in the
specified directory)

------- Start
import java.util.ArrayList;

public class DirectoryClassLoader extends ClassLoader
    private String directory;
    private URLClassLoader loader;

    public DirectoryClassLoader(String directory)
        this(directory, ClassLoader.getSystemClassLoader());

    public DirectoryClassLoader(String directory, ClassLoader parent)

        ArrayList urls = new ArrayList(); = directory;

        if (directory != null)
            File f = new File(directory);
            if (f.exists() && f.isDirectory())
                File children[] = f.listFiles();
                for (int i=0;i<children.length;i++)
                    catch (MalformedURLException e)

        this.loader = new URLClassLoader((URL[])(urls.toArray(new URL[0])), getParent());


    public Class loadClass(String name)
        throws ClassNotFoundException
        return loader.loadClass(name);

    public static void main(String args[])
        throws Exception
        String dir = System.getProperty("");
        DirectoryClassLoader dcl = new DirectoryClassLoader(dir);
        Class c = dcl.loadClass("DirectoryClassLoader");

On Mon, 2001-10-15 at 14:35, Jesse Vitrone wrote:
> I'm sure people have run into this problem there a good
> solution?
> We have a build.bat file which creates the needed classpath, then passes
> that on to Ant to do the build.  We have a lot of jars that need to be
> in the classpath.  Recently, we needed to add another jar, and now the
> build.bat fails because the line length is too long.
> Are we not using Ant right?  Is there a way around this problem that
> we're having?  I would think that people have run into this problem
> before.
> Thanks in advance,
> 	Jesse
Matt Inger (
Sedona Corporation
455 S. Gulph Road, Suite 300
King of Prussia, PA 19406
(484) 679-2213
"Self-respect - the secure feeling that no one,
 as yet, is suspicious." -H.L. Mencken 

View raw message