title: Java load class from Jar and handover complex data type
body: <p>I would like to load a class from another JAR (imported as file during runtime) and handover an Object (this) to the Constructor of the class which should be loaded.</p>
  
  <p>I tried doing that with the following code:</p>
  
  <pre><code>URLClassLoader cl2 = URLClassLoader.newInstance(new URL[] { new URL("jar:file:" + jarPath +"!/") });
  Class c2 = cl2.loadClass("main.Class2BeLoaded");
  Object loadedClass = c2.getConstructor(Object4Constructor.class).newInstance(this));
  </code></pre>
  
  <p>It seems so, that the Object which I handover to the constructor (this) can't be used from the code which runs in the JAR.</p>
  
  <p>What is wrong? If I run this code in the same JAR everything works.</p>