@@ -0,0 +1,2573 @@
+/*%0A * Copyright (c) 2016 Cinchapi Inc.%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A * %0A * http://www.apache.org/licenses/LICENSE-2.0%0A * %0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.cinchapi.common.base;%0A%0Aimport java.io.File;%0Aimport java.net.URISyntaxException;%0Aimport java.net.URL;%0Aimport java.net.URLClassLoader;%0Aimport java.nio.file.Path;%0Aimport java.util.AbstractCollection;%0Aimport java.util.Collection;%0Aimport java.util.Iterator;%0A%0A/**%0A * Utility functions for interacting with the current application instance.%0A * %0A * @author Jeff Nelson%0A */%0Apublic final class Application %7B%0A%0A    /**%0A     * Return a collection of %7B@link Path%7D objects that describe all the%0A     * elements that are on the current application's classpath.%0A     * %0A     * @return the current applications classpath%0A     */%0A    public static Collection%3CPath%3E classpath() %7B%0A        ClassLoader loader = Application.class.getClassLoader();%0A        if(loader == null) %7B%0A            loader = ClassLoader.getSystemClassLoader();%0A        %7D%0A        URL%5B%5D urls = ((URLClassLoader) loader).getURLs();%0A        return new AbstractCollection%3CPath%3E() %7B%0A%0A            @Override%0A            public Iterator%3CPath%3E iterator() %7B%0A%0A                return new AdHocIterator%3CPath%3E() %7B%0A                    private int index = -1;%0A%0A                    @Override%0A                    protected Path findNext() %7B%0A                        ++index;%0A                        if(index %3C urls.length) %7B%0A                            URL url = urls%5Bindex%5D;%0A                            try %7B%0A                                return new File(url.toURI()).toPath();%0A                            %7D%0A                            catch (URISyntaxException e) %7B%0A                                throw CheckedExceptions%0A                                        .throwAsRuntimeException(e);%0A                            %7D%0A                        %7D%0A                        else %7B%0A                            return null;%0A                        %7D%0A                    %7D%0A%0A                %7D;%0A            %7D%0A%0A            @Override%0A            public int size() %7B%0A                return urls.length;%0A            %7D%0A%0A        %7D;%0A    %7D%0A%0A%7D%0A

add Application util class which has method to easily get the classpath