title: How to upgrade javax.naming.* and javax.xml.* imports to be compatible with java 10
body: <p>I have a java project built with maven and jdk 1.8. Some classes use javax.naming.* and javax.xml.* classes in the jdk. 
  From Java 9 onwards those javax packages have been removed from the jdk. So how do I upgrade the project to run on java 9 or later?</p>
  
  <p>Here are the classes,</p>
  
  <pre><code>import javax.naming.Binding;
  import javax.naming.Context;
  import javax.naming.Name;
  import javax.naming.NameClassPair;
  import javax.naming.NameParser;
  import javax.naming.NamingEnumeration;
  import javax.naming.NamingException;
  import javax.naming.NoInitialContextException;
  import javax.naming.directory.Attributes;
  import javax.naming.directory.DirContext;
  import javax.naming.directory.ModificationItem;
  import javax.naming.directory.SearchControls;
  import javax.naming.directory.SearchResult;
  import javax.naming.event.EventContext;
  import javax.naming.event.EventDirContext;
  import javax.naming.event.NamingListener;
  import javax.naming.ldap.Control;
  import javax.naming.ldap.ExtendedRequest;
  import javax.naming.ldap.ExtendedResponse;
  import javax.naming.ldap.LdapContext;
  import javax.naming.spi.InitialContextFactory;
  import javax.naming.spi.InitialContextFactoryBuilder;
  import javax.naming.spi.NamingManager;
  import javax.xml.namespace.QName;
  </code></pre>
  
  <p>I have found out <a href="http://mvnrepository.com/artifact/javax.naming/jndi/1.2.1" rel="nofollow noreferrer">jndi</a> contains javax.naming.* classes. But I am not sure how to include them. Just adding as a maven dependency does not work.</p>