title: Accessing Windows API from a Java application - JNI or JNA?
body: <p><strong>For an exercise</strong>, I would like to develop an application in Java that can make calls to Windows API and register itself for notification on events like key press.</p>
  
  <p>From researches done earlier, I understand that the specific Windows API suitable for my need is the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms644990%28v=vs.85%29.aspx" rel="nofollow noreferrer">SetWindowsHookEx</a> function.</p>
  
  <p><strong>Some have suggested using JNI for this, and others JNA. For the scenario I have described, What are the pros and cons for using either JNI or JNA?</strong></p>
  
  <p>I need opinions on how best to approach solving this problem.</p>
  
  <p>Please do note guys, that I am aware that C/C++ would be most suitable for what I am doing. But like I stated right from the beginning - I am doing this as an exercise, and thus I want to accomplish it using Java.</p>
  
  <hr>
  
  <p>This question is not a duplicate of <a href="https://stackoverflow.com/questions/2389156/calling-win32-api-method-from-java">Calling Win32 API method from Java</a>, for the following reasons:</p>
  
  <ul>
  <li>My question asks, what are the pros and cons of using JNI or JNA.</li>
  <li>The other questions asks <blockquote>how to call an already existing DLL from Java</blockquote></li>
  </ul>
  
  <p>They are just not the same questions.</p>