title: Invalid key code @ java
body: <p>I'm working on a system to type things automatically with java. This is how I write it:</p>
  
  <pre><code>public void typeMessage(String message) {
      for (char c : message.toCharArray()) {
          int code = c;
          if (code &gt; 96 &amp;&amp; code &lt; 123) 
              code = code - 32;
          if (c == '@') {
              robot.keyPress(VK_SHIFT);
              robot.keyPress(VK_AT);
              robot.keyRelease(VK_SHIFT);
              robot.keyRelease(VK_AT);
          } else {
              type(code);
          }
      }
      type(VK_ENTER);
  }
  </code></pre>
  
  <p>But I'm getting this error:</p>
  
  <pre><code>    Exception in thread "Thread-2" java.lang.IllegalArgumentException: Invalid key code
  </code></pre>
  
  <p>on </p>
  
  <pre><code>    robot.keyPress(VK_AT);
  </code></pre>