Initialize javax.naming.InitialContext with System.getProperties
public class InitContext { public static void main(String args[]) throws Exception { javax.naming.Context ctx = new javax.naming.InitialContext(System.getProperties()); System.err.println("Success!"); } }