How to check a file is executable in java

286 Flares Twitter 0 Facebook 0 Google+ 286 LinkedIn 0 Filament.io 286 Flares ×

Many times we may want to check whether a particular file is executable. You many need to trigger a script or an exe. In case it is important to know whether the file is executable before running it. We can use the canExecute() method of the File class for this purpose. This method is available since java 1.6.