title: Find installation directory of JDK in windows
body: <p>I have an application which dynamically loads jvm.dll, therefore I need to know where the DLL resides. Currently I am trying standard locations like <code>C:\Program Files\Java\jdk...\jre\bin\server\jvm.dll</code>. However this is quite tedious and error prone (due to version numbers etc.) and a more sophisticated solution would require some intelligence in my application to determine the correct path. In the worst case I end up asking the user to specify where jvm.dll resides.</p>
  
  <p>On Mac OS X there is a method to find the Java Home directory using /usr/libexec/java_home, on Linux I am mostly fine with simply finding out where <code>javac</code> resides and following symlinks. Is there a similarily simple and sufficient method to find the location of a JDK without try-and-error, searching the whole filesystem, or asking the user?</p>
  
  <p>This question is not about configuring my system such that javac is in my path or anything like that. I want to find, programmatically, the location of a JDK (or JRE for that matter) in a typical misconfigured windows system with screwed path variables and poor directory structures.</p>