title: Can Java inject DLL in another process?
body: <p>I've actually already asked questions regarding my problem. To prevent people asking for <em>irrelevant</em> details <em>over again</em>, I'll post this background info you can skip:</p>
  
  <blockquote>
    <p>I'm making a automation application. This application does some tasks
    for the user over time for specific window. When these taks are
    required to be made, window flashes in taskbar and sometimes even
    steals focus to get the user to do the task. Once the automation is
    here, this is no longer wanted - the user will only focus the window
    when he wants to check how well is the automation doing it's job.</p>
    
    <p>I discovered this <a href="http://code.google.com/p/annoyance/" rel="nofollow noreferrer">focus and flash disable dll</a> project thanks to this <a href="https://superuser.com/a/404246/194976">superuser post about applications stealing focus</a>.</p>
  </blockquote>
  
  <p>My automation application is in Java. So while I can open a DLL injection application and disable flashing manually, I'd like to integrate it in the java applicaton - for example as a setting option. When user selects to disable flashing and stealing focus, the dll will be injected.</p>
  
  <p>Of course, this requires Java to be able to inject my <code>.dll</code> file. I've found this project: <a href="https://github.com/sarxos/dotnet-dll-injector" rel="nofollow noreferrer"><code>dotnet-dll-injector</code></a> but it only deals with .NET dll files.</p>
  
  <p><strong>Q:</strong> Is there a way, in Java, to pick a <code>.dll</code> file and inject it into process? Which libraries would lead to this if the solution isn't straightforward?</p>
  
  <p>I've noticed <code>CreateRemoteThread</code> is somehow related to the DLL injection. Maybe JNA library supports that?</p>