title: Java - Help to transform a String into a class object
body: <p>This is the final result Im aiming to get:</p>
  
  <pre><code>ItemStack block = new ItemStack(Block.dirt, 1);
  </code></pre>
  
  <p>And this is what I have</p>
  
  <pre><code>    String s = "Block.dirt";    
      ItemStack block = new ItemStack(    , 1);
  </code></pre>
  
  <p>It kinda looks impossible, but is there a way to turn the string "Block.dirt" into Block.dirt?</p>
  
  <p>I tried many things, some people suggested me to use GroovyShell and Binding but I cannot do that.</p>
  
  <p>Is there a way to name a object from a string?</p>
  
  <p>Any help is highly appreciated.
  Thank you.</p>
  
  <p>Can I have an example?</p>