1 7 package net.sourceforge.ejtools.deploy; 8 9 import java.io.File ; 11 import java.net.URL ; 12 import java.net.URLClassLoader ; 13 import java.security.AccessController ; 14 import java.security.Permission ; 15 import java.security.PrivilegedExceptionAction ; 16 import java.util.LinkedList ; 17 18 26 public class Main 27 { 28 34 public static void main(String [] args) throws Exception 35 { 36 File pluginDir = new File ("../lib/ext"); 37 LinkedList list = new LinkedList (); 38 File [] plugins = pluginDir.listFiles(); 39 for (int i = 0; i < plugins.length; i++) 40 { 41 System.out.println(plugins[i].toURL()); 42 list.add(plugins[i].toURL()); 43 } 44 pluginDir = new File ("../lib"); 45 plugins = pluginDir.listFiles(); 46 for (int i = 0; i < plugins.length; i++) 47 { 48 System.out.println(plugins[i].toURL()); 49 list.add(plugins[i].toURL()); 50 } 51 URL [] pluginURLs = (URL []) list.toArray(new URL [list.size()]); 52 53 Thread.currentThread().setContextClassLoader(new URLClassLoader (pluginURLs, Thread.currentThread().getContextClassLoader())); 54 55 System.setSecurityManager( 56 new SecurityManager () 57 { 58 public void checkPermission(Permission p) 59 { 60 } 61 62 63 public void checkPermission(Permission perm, Object context) 64 { 65 } 66 }); 67 68 AccessController.doPrivileged( 69 new PrivilegedExceptionAction () 70 { 71 public Object run() 72 throws Exception 73 { 74 java.beans.Beans.instantiate(Thread.currentThread().getContextClassLoader(), "net.sourceforge.ejtools.deploy.DeploymentBrowser"); 75 return null; 76 } 77 }); 78 } 79 } 80 81 | Popular Tags |