title: How can I use a Dynamically created class as Generics?
body: <p>My problem is I do have a class that is created, compiled and initialized at runtime. I did this as writing the file as TestClass which is File f,
  then compile with:</p>
  
  <pre><code>JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
            compiler.run(null,null,null,f.getPath());
  </code></pre>
  
  <p>After that I load my class and use my methods etc. according to this example;
  <a href="http://viralpatel.net/blogs/java-dynamic-class-loading-java-reflection-api/" rel="nofollow">http://viralpatel.net/blogs/java-dynamic-class-loading-java-reflection-api/</a></p>
  
  <p>Now my problem is I need to do this:</p>
  
  <pre><code>MyTask&lt;T&gt; m = new MyTask&lt;T&gt;(0,0,0);
  </code></pre>
  
  <p>T should be my dynamically created class instead of Integer.class etc. However I couldn't find a way for it yet. If you do examine the example at the link I gave above, you will see I can have  a instance of my class as in Object form and I can a Class instance for my dynamic class. However, whatever I tried I couldn't find the solution for this.</p>
  
  <p>It keeps saying that Class myClass, can not be used as a type. So how can I use this dynamically created class as a type. Thank you very much.</p>