title: How to call constructor from class loaded via classloader
body: <p>I use classloader to load a class from a jar, but I get a &quot;NoSuchMethodException&quot; exception when trying to call the default constructor, which does exist.</p>
  <p>The problem may to be that the loaded class is simply java.lang.Class?</p>
  <p>How can I call the constructor?</p>
  <pre><code>Class&lt;?&gt; JRXlsExporter = urlClassLoader.loadClass(&quot;net.sf.jasperreports.engine.export.JRXlsExporter&quot;);
  String classname = JRXlsExporter.getName();     //   looks good... it's net.sf.jasperreports.engine.export.JRXlsExporter
  Class myclass = JRXlsExporter.getClass();           // this might be a a problem, the class is java.lang.Class
  Constructor constructor = myclass.getConstructor();        // throws  java.lang.NoSuchMethodException: java.lang.Class.&lt;init&gt;()
  </code></pre>