title: How to get the full path of an executable in Java, if launched from Windows environment variable PATH?
body: <p>I want to get the path of an executable launched in Java, if the executable is kept in a location which is part of Windows environment variable <code>PATH</code>.</p>
  <p>Say for example, we launch <code>NOTEPAD</code> in windows using the below code snippet. Here <code>notepad.exe</code> is kept under <code>Windows</code> folder which is a part of the Windows environment variable <code>PATH</code>. So no need to give the complete path of the executable here.</p>
  <pre><code>Runtime runtime = Runtime.getRuntime();         
  Process process = runtime.exec(&quot;notepad.exe&quot;);
  </code></pre>
  <p>So my question is, how to get the absolute location of the executables/files in Java programs (in this case if <code>notepad.exe</code> is kept under <code>c:\windows</code>, inside java program I need to get path <code>c:\windows</code>), if they are launched like this from <code>PATH</code> locations?</p>