title: Load jar dynamically at runtime?
body: <p>My current java project is using methods and variables from another project (same package). Right now the other project's jar has to be in the classpath to work correctly. My problem here is that the name of the jar can and will change because of increasing versions, and because you cannot use wildcards in the manifest classpath, it's impossible to add it to the classpath. So currently the only option of starting my application is using the <code>-cp</code> argument from the command line, manually adding the other jar my project depends on.</p>
  
  <p>To improve this, I wanted to load the jar dynamically and read about using the ClassLoader. I read a lot of examples for it, however I still don't understand how to use it in my case.</p>
  
  <p>What I want is it to load a jar file, lets say, <code>myDependency-2.4.1-SNAPSHOT.jar</code>, but it should be able to just search for a jar file starting with <code>myDependency-</code> because as I already said the version number can change at anytime. Then I should just be able to use it's methods and variables in my Code just like I do now (like <code>ClassInMyDependency.exampleMethod()</code>). </p>
  
  <p>Can anyone help me with this, as I've been searching the web for a few hours now and still don't get how to use the ClassLoader to do what I just explained.</p>
  
  <p>Many thanks in advance</p>