Creating and Destroying a Subcontext in the Naming Service This example creates a subcontext in the naming service. try { // Create a subcontext. Context childCtx = ctx.createSubcontext( "child"); // Destroy the subcontext. ctx.destroySubcontext( "child"); } catch (NamingException e) { }