Here you can find the source of findExecutable(String executableName)
static public File findExecutable(String executableName)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { static public File findExecutable(String executableName) { String systemPath = System.getenv("PATH"); String[] pathDirs = systemPath.split(File.pathSeparator); File fullyQualifiedExecutable = null; for (String pathDir : pathDirs) { File file = new File(pathDir, executableName); if (file.isFile() && file.canExecute()) { fullyQualifiedExecutable = file; break; }/* w ww . j a v a 2 s . c o m*/ } return fullyQualifiedExecutable; } }