
Static Public Member Functions | |
| static void | addFile (final String s, int i) throws IOException |
| static void | addFile (final File f, int i) throws IOException |
| static void | addURL (final URL u, int i) |
| static String[] | getClassPath () |
| static void | loadBackGroundClassPath () |
Static Private Attributes | |
| static final Class[] | parameters = new Class[]{URL.class} |
| static Vector< URL > | queued = new Vector<URL>() |
Definition at line 31 of file ClassPath.java.
| static void javasci::ClassPath::addFile | ( | final String | s, | |
| int | i | |||
| ) | throws IOException [inline, static] |
| static void javasci::ClassPath::addFile | ( | final File | f, | |
| int | i | |||
| ) | throws IOException [inline, static] |
| static void javasci::ClassPath::addURL | ( | final URL | u, | |
| int | i | |||
| ) | [inline, static] |
Add a URL to classpath.
| u | URL of the classes (jar or path) | |
| i | the type of load: i=0 startup / i=1 background / i=2 onUse |
Definition at line 61 of file ClassPath.java.
References Method, parameters, and queued.
Referenced by addFile().
00061 { 00062 00063 final URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader(); 00064 Class sysclass = URLClassLoader.class; 00065 00066 try { 00067 00068 final Method method = sysclass.getDeclaredMethod("addURL", parameters); 00069 method.setAccessible(true); 00070 switch (i) { 00071 case 0: /* Load now */ 00072 method.invoke(sysloader , new Object[] { u }); 00073 break; 00074 case 1: /* Load later (background) */ 00075 queued.add(u); 00076 break; 00077 } 00078 00079 } catch (NoSuchMethodException e) { 00080 System.err.println("Error: Cannot find the declared method: " + e.getLocalizedMessage()); 00081 } catch (IllegalAccessException e) { 00082 System.err.println("Error: Illegal access: " + e.getLocalizedMessage()); 00083 } catch (InvocationTargetException e) { 00084 System.err.println("Error: Could not invocate target: " + e.getLocalizedMessage()); 00085 } 00086 00087 }

| static String [] javasci::ClassPath::getClassPath | ( | ) | [inline, static] |
Get the classpath loaded
Definition at line 93 of file ClassPath.java.
References i.
00093 { 00094 00095 URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader(); 00096 URL[] path = sysloader.getURLs(); 00097 String[] paths = new String[path.length]; 00098 for (int i = 0; i < path.length; i++) { 00099 paths[i] = path[i].getFile(); 00100 } 00101 return paths; 00102 }
| static void javasci::ClassPath::loadBackGroundClassPath | ( | ) | [inline, static] |
Load all the classpath in dedicated threads in background
Definition at line 108 of file ClassPath.java.
00108 { 00109 Thread backgroundLoader = new Thread() { 00110 public void run() { 00111 try { 00112 00113 Iterator<URL> urlIt = queued.iterator(); 00114 00115 while (urlIt.hasNext()) { 00116 ClassPath.addURL(urlIt.next(),0); 00117 } 00118 00119 }catch (Exception e){ 00120 System.err.println("Error : "+e.getLocalizedMessage()); 00121 } 00122 } 00123 }; 00124 backgroundLoader.start(); 00125 }

final Class [] javasci::ClassPath::parameters = new Class[]{URL.class} [static, private] |
Vector<URL> javasci::ClassPath::queued = new Vector<URL>() [static, private] |
Definition at line 35 of file ClassPath.java.
Referenced by addURL(), and loadBackGroundClassPath().
1.5.5