Class WinAssociations

java.lang.Object
com.install4j.api.windows.WinAssociations

public class WinAssociations extends Object
Collection of static methods to create and remove file associations on Microsoft Windows.
  • Method Details

    • create

      public static void create(String extension, String description, File iconFile, File executable)
      Creates a file association.
      Parameters:
      extension - the extension including the leading dot (e.g. ".doc").
      description - a description of the file type.
      iconFile - the icon file for the document. May be null.
      executable - the executable that shall be called with the file as parameter.
    • exists

      public static boolean exists(String extension)
      Checks whether a file association already exists.
      Parameters:
      extension - the extension including the leading dot (e.g. ".doc").
      Returns:
      true if an association exists
    • getExecutable

      public static String getExecutable(String extension)
      Retrieves the executable associated with an extension.
      Parameters:
      extension - the extension including the leading dot (e.g. ".doc").
      Returns:
      the executable associated with the given extension. Null if there is no association.
    • remove

      public static void remove(String extension)
      Removes a file association.
      Parameters:
      extension - the extension including the leading dot (e.g. ".doc").