String jndiPropsFilename;
// If no properties file is specified, use the default file;
// otherwise use the specified file
if (v.isEmpty())
jndiPropsFilename = NamingShell.getDefaultPropsFilename();
else
jndiPropsFilename = (String)v.firstElement();
try {
Properties props = new Properties();
File jndiProps = new File(jndiPropsFilename);
props.load(new FileInputStream(jndiProps));
NamingShell.setInitialContext(new InitialContext(props));
NamingShell.setInitialName("/");
NamingShell.setCurrentContext(NamingShell.getInitialContext());
NamingShell.setCurrentName(NamingShell.getInitialName());
System.out.print("Created initial context using ");
System.out.println(jndiProps.getAbsolutePath());
}
catch (NamingException ne) {
System.out.println("Couldn't create the initial context.");
System.out.println("BASE EXCEPTION " + ne);
}
catch (FileNotFoundException fnfe) {
System.out.print("Couldn't find properties file: ");
System.out.println(jndiPropsFilename);
}
catch (IOException ioe) {
System.out.print("Problem loading the properties file: ");
System.out.println(jndiPropsFilename);
}
catch (Exception e) {
System.out.println("There was a problem starting the shell.");
}