1 11 12 package org.jivesoftware.messenger.starter; 13 14 import java.io.File ; 15 import java.io.FilenameFilter ; 16 import java.net.MalformedURLException ; 17 import java.net.URL ; 18 import java.net.URLClassLoader ; 19 20 32 class JiveClassLoader extends URLClassLoader { 33 34 41 JiveClassLoader(ClassLoader parent, File libDir) throws MalformedURLException { 42 super(new URL [] { libDir.toURL() }, parent); 43 44 File [] jars = libDir.listFiles(new FilenameFilter () { 45 public boolean accept(File dir, String name) { 46 boolean accept = false; 47 String smallName = name.toLowerCase(); 48 if (smallName.endsWith(".jar")) { 49 accept = true; 50 } 51 else if (smallName.endsWith(".zip")) { 52 accept = true; 53 } 54 return accept; 55 } 56 }); 57 58 if (jars == null) { 60 return; 61 } 62 63 for (int i = 0; i < jars.length; i++) { 64 if (jars[i].isFile()) { 65 addURL(jars[i].toURL()); 66 } 67 } 68 } 69 } 70 | Popular Tags |