Java Jar File Find findJars(File folder)

Here you can find the source of findJars(File folder)

Description

Returns all JAR files in folder.

License

Apache License

Parameter

Parameter Description
folder the folder to analyze

Return

all JAR files in folder

Declaration

public static List<File> findJars(File folder) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**/*from  www .  j a  v  a2 s.c  o  m*/
     * Returns all JAR files in <code>folder</code>.
     * 
     * @param folder the folder to analyze
     * @return all JAR files in <code>folder</code>
     */
    public static List<File> findJars(File folder) {
        List<File> result = new ArrayList<File>();
        File[] plugins = folder.listFiles();
        if (null != plugins) {
            for (File f : plugins) {
                if (f.getName().endsWith(".jar")) {
                    result.add(f);
                }
            }
        }
        System.out.println("JARS found: " + result.toString());
        return result;
    }
}

Related

  1. findJar(File dir)
  2. findJar(String nameRegexp)
  3. findJarContaining(Class c)
  4. findJarEntry(String entryName, JarInputStream jarFile)
  5. findJarFiles(String[] classPathLines)
  6. findJars(File libDir)
  7. findJarsDir(String sparkHome, String scalaVersion, boolean failIfNotFound)
  8. findJarsFromDirectory(File targetDirectory)
  9. findJarsNamesInPath(String path)