Class LibrarySearchPathManager


  • public class LibrarySearchPathManager
    extends java.lang.Object
    A simple class for managing the library search path and avoiding duplicate directories.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CURRENT_DIRECTORY  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean addPath​(java.lang.String path)
      Adds the specified path to the end of the path search list.
      static boolean addPathAt​(int index, java.lang.String path)
      Adds the path at the specified index in path search list.
      static void clear()
      Clears all paths.
      static java.lang.String[] getLibraryPaths()
      Returns an array of directories to search for libraries
      static java.util.List<java.lang.String> getLibraryPathsList()
      Returns an array of directories to search for libraries
      static boolean removePath​(java.lang.String path)
      Removes the path from the path search list.
      static void reset()
      Resets the library search path to match the system search paths.
      static void restoreLibraryPaths​(java.lang.String[] paths)
      Call this to restore paths that were previously persisted.
      static void setLibraryPaths​(java.lang.String[] paths)
      Sets the directories to search for libraries
      • Methods inherited from class java.lang.Object

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

      • CURRENT_DIRECTORY

        public static final java.lang.String CURRENT_DIRECTORY
        See Also:
        Constant Field Values
    • Constructor Detail

      • LibrarySearchPathManager

        public LibrarySearchPathManager()
    • Method Detail

      • getLibraryPaths

        public static java.lang.String[] getLibraryPaths()
        Returns an array of directories to search for libraries
        Returns:
        an array of directories to search for libraries
      • getLibraryPathsList

        public static java.util.List<java.lang.String> getLibraryPathsList()
        Returns an array of directories to search for libraries
        Returns:
        a list of directories to search for libraries
      • setLibraryPaths

        public static void setLibraryPaths​(java.lang.String[] paths)
        Sets the directories to search for libraries
        Parameters:
        paths - the new library search paths
      • restoreLibraryPaths

        public static void restoreLibraryPaths​(java.lang.String[] paths)
        Call this to restore paths that were previously persisted. If you really need to change the paths for the entire JVM, then call setLibraryPaths(String[]).
        Parameters:
        the - paths to restore
      • addPath

        public static boolean addPath​(java.lang.String path)
        Adds the specified path to the end of the path search list.
        Parameters:
        path - the path to add
        Returns:
        true if the path was appended, false if the path was a duplicate
      • addPathAt

        public static boolean addPathAt​(int index,
                                        java.lang.String path)
        Adds the path at the specified index in path search list.
        Parameters:
        path - the path to add
        Returns:
        true if the path was appended, false if the path was a duplicate
      • removePath

        public static boolean removePath​(java.lang.String path)
        Removes the path from the path search list.
        Parameters:
        path - the path the remove
        Returns:
        true if the path was removed, false if the path did not exist
      • reset

        public static void reset()
        Resets the library search path to match the system search paths.
      • clear

        public static void clear()
        Clears all paths.