Example usage for org.aspectj.util LangUtil splitClasspath

List of usage examples for org.aspectj.util LangUtil splitClasspath

Introduction

In this page you can find the example usage for org.aspectj.util LangUtil splitClasspath.

Prototype

public static String[] splitClasspath(String classpath) 

Source Link

Document

Split string as classpath, delimited at File.pathSeparator.

Usage

From source file:org.eclipse.ajdt.core.ant.AjcTask.java

License:Open Source License

/**
 * Find aspectjtools.jar on the task or system classpath. Accept <code>aspectj{-}tools{...}.jar</code> mainly to support build
 * systems using maven-style re-naming (e.g., <code>aspectj-tools-1.1.0.jar</code>. Note that we search the task classpath
 * first, though an entry on the system classpath would be loaded first, because it seems more correct as the more specific one.
 * /*from   www  .j  a v  a  2  s. c om*/
 * @return readable File for aspectjtools.jar, or null if not found.
 */
public static File findAspectjtoolsJar() {
    File result = null;
    ClassLoader loader = AjcTask.class.getClassLoader();
    if (loader instanceof AntClassLoader) {
        AntClassLoader taskLoader = (AntClassLoader) loader;
        String cp = taskLoader.getClasspath();
        String[] cps = LangUtil.splitClasspath(cp);
        for (int i = 0; (i < cps.length) && (null == result); i++) {
            result = isAspectjtoolsjar(cps[i]);
        }
    }
    if (null == result) {
        final Path classpath = Path.systemClasspath;
        final String[] paths = classpath.list();
        for (int i = 0; (i < paths.length) && (null == result); i++) {
            result = isAspectjtoolsjar(paths[i]);
        }
    }
    return (null == result ? null : result.getAbsoluteFile());
}