File workingDirectory = ...; Partition partition = new JdbmPartition(); partition.setId(...); partition.setSuffix(...); DirectoryService directoryService = new DefaultDirectoryService(); directoryService.setWorkingDirectory(workingDirectory); directoryService.addPartition(partition); LdapService ldapService = new LdapService(); ldapService.setSocketAcceptor(new SocketAcceptor(null)); ldapService.setIpPort(...); ldapService.setDirectoryService(directoryService); directoryService.startup(); ldapService.start();