title: Java JNDI Name java:/
body: <p>I'm following the tutorial: <a href="https://docs.oracle.com/javase/tutorial/jndi/index.html">https://docs.oracle.com/javase/tutorial/jndi/index.html</a></p>
  
  <p>My adventure started while setting a JNDI name for a datasource with the WildFly application server. The name started with "java:/". I was curious on what it was and how it worked.</p>
  
  <p>I have Apache Directory LDAP server setup locally and I'm able to connect to it with:</p>
  
  <pre><code>Hashtable&lt;String, Object&gt; env = new Hashtable&lt;String, Object&gt;();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
      env.put(Context.PROVIDER_URL, "ldap://localhost:10389/o=JNDITutorial");
      env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
      env.put(Context.SECURITY_CREDENTIALS, "secret");
  
      try {
          Context ctx = new InitialContext(env);
          Object obj = ctx.lookup("cn=Rosanna Lee,ou=People");
      } catch (NamingException e) {
          e.printStackTrace();
      }
  </code></pre>
  
  <p>My confusion is the JNDI name "java:/".</p>
  
  <p>Can someone please explain what "java:/" is and how I can use JNDI to interact with it?</p>
  
  <p>My assumption is its a directory located somewhere on my computer. </p>
  
  <p>Thank you.</p>