Java Jar File Find findAllPluginJars0(final File pluginPath)

Here you can find the source of findAllPluginJars0(final File pluginPath)

Description

find All Plugin Jars

License

Apache License

Declaration

private static List<URL> findAllPluginJars0(final File pluginPath) throws IOException 

Method Source Code


//package com.java2s;
/*//  ww  w. j  a  v  a2 s.c  o  m
 * Copyright (C) 2011 Rhegium Team
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.io.File;

import java.io.IOException;

import java.net.URL;
import java.util.ArrayList;

import java.util.List;

public class Main {
    private static List<URL> findAllPluginJars0(final File pluginPath) throws IOException {
        final List<URL> jars = new ArrayList<URL>();
        for (final File entry : pluginPath.listFiles()) {
            if (entry.isDirectory()) {
                jars.addAll(findAllPluginJars0(entry));
            } else if (entry.isFile() && entry.getName().toLowerCase().endsWith(".jar")) {
                jars.add(entry.toURI().toURL());
            }
        }

        return jars;
    }
}

Related

  1. findClassJar(final Class aClass)
  2. findContainingJar( @SuppressWarnings("rawtypes") Class my_class, ClassLoader loader)
  3. findContainingJar(Class my_class)
  4. findContainingJar(Class clazz)