Class ToolFinder


  • public class ToolFinder
    extends java.lang.Object
    Finds external tools to execute.
    See Also:
    ToolRunner
    • Constructor Summary

      Constructors 
      Constructor Description
      ToolFinder()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.File find​(java.lang.String toolName)
      Finds the file of a tool's excecutable.
      protected java.io.File loadTool​(java.io.File toolDir, java.lang.String toolName)
      Loads a tool by its name.
      Tries OS specific suffixes.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ToolFinder

        public ToolFinder()
    • Method Detail

      • find

        public java.io.File find​(java.lang.String toolName)
        Finds the file of a tool's excecutable.

        If the toolname does not point to a valid executable, the environment's PATH variable is consulted.

        Depending on the OS, it will also try to append well-known suffixes to the toolName. Windows: ".exe", ".cmd" and ".bat". Others (Unixes): ".sh".

        Parameters:
        toolName - the platform independent tool name
        Returns:
        file representing the tool's executable, or null if the tool can not be found
      • loadTool

        protected java.io.File loadTool​(java.io.File toolDir,
                                        java.lang.String toolName)
        Loads a tool by its name.
        Tries OS specific suffixes.
        Parameters:
        toolDir - the directory of the tool
        toolName - the tool's name
        Returns:
        the tool's file, null if not found