PLBootstrap.javaAPI DocGlassfish v2 API6991Fri May 04 22:34:36 BST 2007None


public class PLBootstrap extends Object
This class is used for executing processes that are in an envronment that has a VERY limited command line execute size. The links off the start menu in windows has a maximum size of 259 characters. The PLBootstart requires that appserver installroot path is in the command twice and the java installroot is the in the command once, so allowance have to be given for user directory location preference. The reason, PLBoostrap is not placed inside a package is to keep the command size as small as possible. The associated properties file holds the classpath and property information requirer to setup the environment.

Fields Summary
public static final String
public static final String
public static final String
public static final String
public static final boolean
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        try {
            Properties props=System.getProperties();
            if (bDebug) props.list(System.out);
            // get processLauncher properties from installroot property
            // directory as this class
            String installRoot=System.getProperty(INSTALL_ROOT_PROPERTY_NAME);
            if (installRoot == null) {
                System.out.println("ERROR: The System property \"com.sun.aas.installRoot\" has to be set!");
            String appservLibPath=installRoot + File.separator + "lib" + File.separator;    
            // compile location to the properties file
            if (bDebug) System.out.println("Reading properties from - " + appservLibPath + PROCESS_LAUCHER_PROPERTIES_FILE_NAME);
            File propertiesFile=new File(appservLibPath + PROCESS_LAUCHER_PROPERTIES_FILE_NAME);
            // see if properties exit, if not exception
            if (!propertiesFile.canRead()) {
                throw new FileNotFoundException(propertiesFile.getPath());

            // load properties from file
            Properties properties=new Properties();
            FileInputStream fInput=new FileInputStream(propertiesFile);

            // get the classpath property and create an appropriate classloader
            URL[] classJars=stringToURLArray(appservLibPath, properties.getProperty(PROCESS_LAUCHER_LIBRARIES));
            URLClassLoader classLoader=new URLClassLoader(classJars, Thread.currentThread().getContextClassLoader());

            // Load ProcessLauncher class
            Class plClass=classLoader.loadClass(properties.getProperty(PROCESS_LAUCHER_MAIN_CLASS));
            if (bDebug) System.out.println("classloader = " + classLoader + " - " + plClass.getClassLoader());

            // get the method
            Method mainMethod=plClass.getDeclaredMethod("bootstrap", new Class[]{ String[].class });
            mainMethod.invoke(null, new Object[]{ args });
            // explicit exit
       } catch (Throwable t) {

private static[]stringToURLArray(java.lang.String appservLibPath, java.lang.String jarList)

        if (bDebug) System.out.println("jar list - " + jarList);
        // make sure list exists
        if (jarList == null || jarList.equals("")) {
            return new URL[0];

        // loop though a build arraylist of jars
        ArrayList jars=new ArrayList();
        StringTokenizer stJars=new StringTokenizer(jarList, ",");
        URL resultantURL=null;
        String jarName=null, jarPath=null;
        while (stJars.hasMoreTokens()) {
            if (bDebug) System.out.println("creating url for - " + jarName);
            // if name starts with a "/" use is as a full path
            if (jarName.startsWith("/")) {
            } else {
                jarPath=appservLibPath + jarName;
            // should be in local path
            resultantURL=new URL("file:" + jarPath);
            if (bDebug) System.out.println("resultant url - " + resultantURL);
        return (URL[])jars.toArray(new URL[jars.size()]);