FileDocCategorySizeDatePackage
env.javaAPI DocExample2594Thu Dec 15 21:15:10 GMT 2005com.oreilly.jent.jndi

env

public class env extends Object implements Command
env: Command to print the environment parameters of the current context.

Fields Summary
Constructors Summary
Methods Summary
public voidexecute(javax.naming.Context c, java.util.Vector v)

            
        if (c == null)
            throw new CommandException(new Exception(),
                "No current context");
        try {
            Hashtable env = NamingShell.getInitialContext().getEnvironment();
            Enumeration envEnum = env.keys();
            String key;
            while (envEnum.hasMoreElements()) {
                key = (String)envEnum.nextElement();
                System.out.println(key + "\t" + env.get(key));
            }

            Hashtable sysProps = System.getProperties();
            Enumeration sysEnum = sysProps.keys();
            while (sysEnum.hasMoreElements()) {
                key = (String)sysEnum.nextElement();
                System.out.println(key + "\t" + sysProps.get(key));
            }
        }
        catch (NamingException ne) {
            throw new CommandException(ne, "Couldn't get the environment of " 
                + NamingShell.getCurrentContext());
        }
    
public voidhelp()

 System.out.println("Usage: env");