Class JarUtils


  • public final class JarUtils
    extends Object
    A small collection of Jar file utilities.
    • Method Detail

      • getJarURLs

        public static URL[] getJarURLs()
                                throws IOException
        Gets a list of jar files in the classpath (this includes jars in jars, one level deep).
        Returns:
        An array of URLs found in the classpath
        Throws:
        IOException - If there is trouble reading the classpath
      • extract

        public static void extract​(String aJarFilePath,
                                   String aFilePath,
                                   File aDestDir)
                            throws IOException
        Extract a particular path from a supplied Jar file to a supplied File location.
        Parameters:
        aJarFilePath - A path to a Jar file from which to extract
        aFilePath - The Jar file path of the file to extract
        aDestDir - The destination directory into which the file should be extracted
        Throws:
        IOException - If there is an exception thrown while reading or writing the file
      • extract

        public static void extract​(File aJarFile,
                                   String aFilePath,
                                   File aDestDir)
                            throws IOException
        Extract a particular path from a supplied Jar file to a supplied File location.
        Parameters:
        aJarFile - A Jar file from which to extract
        aFilePath - The Jar file path of the file to extract
        aDestDir - The destination directory into which the file should be extracted
        Throws:
        IOException - If there is an exception thrown while reading or writing the file
      • extract

        public static void extract​(JarFile aJarFile,
                                   String aFilePath,
                                   File aDestDir)
                            throws IOException
        Extract a particular path from a supplied Jar file to a supplied File location.
        Parameters:
        aJarFile - A Jar file from which to extract
        aFilePath - The Jar file path of the file to extract
        aDestDir - The destination directory into which the file should be extracted
        Throws:
        IOException - If there is an exception thrown while reading or writing the file