title: Decide on runtime which library needs to be used on JBoss
body: <p>is there a way to decide during runtime, which class from which jar (deployed on jboss) will be used?</p>
  
  <p>Here is an example:</p>
  
  <p><code>VERSION1.JAR</code></p>
  
  <pre><code>package com.something;
  
  public class MyObject {
  
     public void saySomething() {
         System.out.println("Output from version 1");
     }
  }
  </code></pre>
  
  <p><code>VERSION2.JAR</code></p>
  
  <pre><code>package com.something;
  
  public class MyObject {
  
     public void saySomething() {
         System.out.println("Output from version 2");
     }
  }
  </code></pre>
  
  <p>So in both jars are the same class within the same package but they do different things. Now I want to load MyObject but tell him from which jar I want to use that:</p>
  
  <pre><code>package com.main
  
  public class Main{
  
     public static void main(String[] args) {
  
          MyObject v1 = new MyObject();
          v1.saySomething();
  
          MyObject v2 = new MyObject();
          v2.saySomething();
  
     }
  }
  </code></pre>
  
  <p>Is that possible? I am using Jboss as application server and I am doing that within a ejb project. So this example is just to explain what I mean. I think maybe with help of the context?</p>