Is there a good way to determine if a file is executable in Java
<p>I'm aware you can call </p>

<pre><code>Runtime.getRuntime().exec(file);
</code></pre>

<p>and get an exception if it is not executable, however this is unsafe since running an executable can have side effects.</p>

<p>I guess just checking the extension is enough on Windows, but is there a way I can read the executable bit on *nix file systems?</p>

<p>What is the best way to find out if an file is executable in the OS?</p>
