Creating and Destroying a Subcontext in the Naming Service - Java JNDI

Java examples for JNDI:Context

Description

Creating and Destroying a Subcontext in the Naming Service

Demo Code

import javax.naming.Context;
import javax.naming.NamingException;

public class Main {

  public static void main(String[] argv) {
    try {/*from w  w  w. ja va  2  s .  c  o m*/
      // Create a subcontext.
      Context ctx = null;
      Context childCtx = ctx.createSubcontext("child");

      // Destroy the subcontext.
      ctx.destroySubcontext("child");
    } catch (NamingException e) {
    }
  }
}

Related Tutorials