You can aither use jndi.property concept or you can use as follows :
String url = //yr server url;
String factory = //yr factory ctx
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, factory);
properties.put(Context.PROVIDER_URL, url);
Context ctx =InitialContext(properties);
Hope this will work out