public class ExecutableFinder extends Object
getExecutables("netbeans*", "bin/netbeans*.exe will look for directories whose name begins
 with "netbeans" (for example netbeans 8.2 would be a valid name), and files whose name begins with
 "netbeans" and with an ".exe" extension under these directories.
 
 ExecutableFinder finder = new ExecutableFinder(false);
 finder.addRootFromEnv("programfiles");
 List<File> files = finder.getExecutables("netbeans*", "bin/*.exe");
 
 If we have only one Netbeans installation, the method will return two files:
 Netbeans.exe executableNetbeans64.exe executableNetbeans.exe executableNetbeans64.exe executable
 ExecutableFinder finder = new ExecutableFinder(true);
 finder.addAllRoots();
 List<File> files = finder.getExecutables("python*", "*.exe");
 | Modifier and Type | Field and Description | 
|---|---|
static short | 
MODE_ALL
Represents the mode where a root maybe either the parent of a directory containing the executable, or this
 directory itself. 
 | 
static short | 
MODE_PATTERN
Represents the mode where a root may only be a directory containing the executable. 
 | 
static short | 
MODE_ROOT
Represents the mode where a root may only be the parent of a directory containing the executable. 
 | 
| Constructor and Description | 
|---|
ExecutableFinder(boolean isStrict)
Constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addAllRoots()
Add all the file system root directories for the finder. 
 | 
boolean | 
addRoot(File root)
Add a root directory for the finder. 
 | 
boolean | 
addRootFromEnv(String env)
Add a root directory or several root directories from an environment variable, with the
  
MODE_ALL mode. | 
boolean | 
addRootFromEnv(String env,
              short mode)
Add a root directory or several root directories from an environment variable. 
 | 
List<File> | 
getExecutables(String dirPattern,
              String filePattern)
Return a list of executables from a directory Pattern and file pattern. 
 | 
boolean | 
isCaseInsensitive()
Return true if the finder is case insensitive. 
 | 
void | 
setCaseInsensitive(boolean caseInsensitive)
Set the finder as case insensitive. 
 | 
public static final short MODE_ALL
public static final short MODE_ROOT
public static final short MODE_PATTERN
public ExecutableFinder(boolean isStrict)
isStrict - true if the finder must find only executables which are defined for the JVM architecturepublic boolean addRoot(File root)
root - the root directorypublic void addAllRoots()
public void setCaseInsensitive(boolean caseInsensitive)
caseInsensitive - true if the finder must be caseInsensitivepublic boolean isCaseInsensitive()
public boolean addRootFromEnv(String env)
MODE_ALL mode.env - the environment variablepublic boolean addRootFromEnv(String env, short mode)
MODE_ALL: Represents the mode where a root maybe either the parent of a directory contining the executable, or this
 directory itselfMODE_ROOT: Represents the mode where a root may only be the parent of a directory containing the executableMODE_PATTERN: Represents the mode where a root may only be a directory containing the executableenv - the environment variablemode - the modepublic List<File> getExecutables(String dirPattern, String filePattern)
getExecutables("netbeans*", "bin/netbeans*.exe will look for directories whose name begins
 with "netbeans" (for example netbeans 8.2 would be a valid name), and files whose name begins with
 "netbeans" and with an ".exe" extension under these directories.
 dirPattern - the directory PatternfilePattern - the file pattern