Class WinAssociations


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void create​(java.lang.String extension, java.lang.String description, java.io.File iconFile, java.io.File executable)
      Creates a file association.
      static boolean exists​(java.lang.String extension)
      Checks whether a file association already exists.
      static java.lang.String getExecutable​(java.lang.String extension)
      Retrieves the executable associated with an extension.
      static void remove​(java.lang.String extension)
      Removes a file association.
      • Methods inherited from class java.lang.Object

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

      • create

        public static void create​(java.lang.String extension,
                                  java.lang.String description,
                                  java.io.File iconFile,
                                  java.io.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​(java.lang.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 java.lang.String getExecutable​(java.lang.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​(java.lang.String extension)
        Removes a file association.
        Parameters:
        extension - the extension including the leading dot (e.g. ".doc").