1 import java.security.AccessController;
2 import sun.security.action.*;
5 public class classloader {
6 private static String[] initializePath(String propname) {
7 String ldpath = System.getProperty(propname, "");
8 String ps = File.pathSeparator;
9 int ldlen = ldpath.length();
11 // Count the separators in the path
12 i = ldpath.indexOf(ps);
16 i = ldpath.indexOf(ps, i+1);
19 // allocate the array of paths - n :'s = n + 1 path elements
20 String[] paths = new String[n + 1];
22 // Fill the array with paths from the ldpath
24 j = ldpath.indexOf(ps);
27 paths[n++] = ldpath.substring(i, j);
28 } else if (j - i == 0) {
32 j = ldpath.indexOf(ps, i);
34 paths[n] = ldpath.substring(i, ldlen);
38 public static void main (String args[]) {
40 String dirs[] = initializePath("sun.boot.library.path");
42 System.out.println("length: " + dirs.length);
43 for (int i = 0; i < dirs.length; ++i) {
44 System.out.println(dirs[i]);
47 AccessController.doPrivileged(new LoadLibraryAction("net"));