title: Dynamically find the class that represents a primitive Java type
body: <p>I need to make some reflective method calls in Java. Those calls will include methods that have arguments that are primitive types (int, double, etc.). The way to specify such types when looking up the method reflectively is int.class, double.class, etc.</p>
  
  <p>The challenge is that I am accepting input from an outside source that will specify the types dynamically. Therefore, I need to come up with these Class references dynamically as well. Imagine a delimited file a list of method names with lists of parameter types:</p>
  
  <pre><code>doSomething int double
  doSomethingElse java.lang.String boolean
  </code></pre>
  
  <p>If the input was something like <code>java.lang.String</code>, I know I could use <code>Class.forName("java.lang.String")</code> to that Class instance back. Is there any way to use that method, or another, to get the primitive type Classes back?</p>
  
  <p><strong>Edit:</strong>
  Thanks to all the respondents. It seems clear that there is no built-in way to cleanly do what I want, so I will settle for reusing the <code>ClassUtils</code> class from the Spring framework. It seems to contain a replacement for Class.forName() that will work with my requirements.</p>