title: How to import duplicate package structures and classes in a Java application
body: <p>I am wondering if there is a way around this problem without changing the package structures.</p>
  
  <p>I have 2 similar web apps with identical package structures. Classes are the named the same as well.</p>
  
  <p>I would like to use both versions of these packages and create objects from the classes in a third app.</p>
  
  <p>The reason for this and as an example, is that I want to create a single web app that manages user accounts for these 2 other web apps. The package structure for both is <code>com/mycompany/User.java</code></p>
  
  <p>The problem (as I see it) is that I can't just have these 2 apps package structures in my classpath and have a way to differentiate between them when creating objects.</p>
  
  <p>i.e.</p>
  
  <p>When creating a <code>User</code> object, how can I specify that I want to create it from package 1 or package 2. I don't want to refactor the code or change the way the apps packages are structured.</p>