Class Executable


  • public class Executable
    extends java.lang.Object
    This class enables you to call an executable that will show a PDF file.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String acroread
      The path to Acrobat Reader.
    • Constructor Summary

      Constructors 
      Constructor Description
      Executable()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.Process action​(java.lang.String fileName, java.lang.String parameters, boolean waitForTermination)
      Performs an action on a PDF document.
      private static java.lang.String[] createCommand​(java.lang.String... arguments)
      Creates a command string array from the string arguments.
      static boolean isLinux()
      Checks the Operating System.
      static boolean isMac()
      Checks the Operating System.
      static boolean isWindows()
      Checks the Operating System.
      static boolean isWindows9X()
      Checks the Operating System.
      static void launchBrowser​(java.lang.String url)
      Launches a browser opening an URL.
      static java.lang.Process openDocument​(java.io.File file)
      Opens a PDF document.
      static java.lang.Process openDocument​(java.io.File file, boolean waitForTermination)
      Opens a PDF document.
      static java.lang.Process openDocument​(java.lang.String fileName)
      Opens a PDF document.
      static java.lang.Process openDocument​(java.lang.String fileName, boolean waitForTermination)
      Opens a PDF document.
      static java.lang.Process printDocument​(java.io.File file)
      Prints a PDF document.
      static java.lang.Process printDocument​(java.io.File file, boolean waitForTermination)
      Prints a PDF document.
      static java.lang.Process printDocument​(java.lang.String fileName)
      Prints a PDF document.
      static java.lang.Process printDocument​(java.lang.String fileName, boolean waitForTermination)
      Prints a PDF document.
      static java.lang.Process printDocumentSilent​(java.io.File file)
      Prints a PDF document without opening a Dialog box.
      static java.lang.Process printDocumentSilent​(java.io.File file, boolean waitForTermination)
      Prints a PDF document without opening a Dialog box.
      static java.lang.Process printDocumentSilent​(java.lang.String fileName)
      Prints a PDF document without opening a Dialog box.
      static java.lang.Process printDocumentSilent​(java.lang.String fileName, boolean waitForTermination)
      Prints a PDF document without opening a Dialog box.
      • Methods inherited from class java.lang.Object

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

      • acroread

        private static java.lang.String acroread
        The path to Acrobat Reader.
    • Constructor Detail

      • Executable

        public Executable()
    • Method Detail

      • action

        private static java.lang.Process action​(java.lang.String fileName,
                                                java.lang.String parameters,
                                                boolean waitForTermination)
                                         throws java.io.IOException
        Performs an action on a PDF document.
        Parameters:
        fileName -
        parameters -
        waitForTermination -
        Returns:
        a process
        Throws:
        java.io.IOException
      • createCommand

        private static java.lang.String[] createCommand​(java.lang.String... arguments)
        Creates a command string array from the string arguments.
        Parameters:
        arguments -
        Returns:
        String[] of commands
      • openDocument

        public static java.lang.Process openDocument​(java.lang.String fileName,
                                                     boolean waitForTermination)
                                              throws java.io.IOException
        Opens a PDF document.
        Parameters:
        fileName - the name of the file to open
        waitForTermination - true to wait for termination, false otherwise
        Returns:
        a process
        Throws:
        java.io.IOException - on error
      • openDocument

        public static java.lang.Process openDocument​(java.io.File file,
                                                     boolean waitForTermination)
                                              throws java.io.IOException
        Opens a PDF document.
        Parameters:
        file - the file to open
        waitForTermination - true to wait for termination, false otherwise
        Returns:
        a process
        Throws:
        java.io.IOException - on error
      • openDocument

        public static java.lang.Process openDocument​(java.lang.String fileName)
                                              throws java.io.IOException
        Opens a PDF document.
        Parameters:
        fileName - the name of the file to open
        Returns:
        a process
        Throws:
        java.io.IOException - on error
      • openDocument

        public static java.lang.Process openDocument​(java.io.File file)
                                              throws java.io.IOException
        Opens a PDF document.
        Parameters:
        file - the file to open
        Returns:
        a process
        Throws:
        java.io.IOException - on error
      • printDocument

        public static java.lang.Process printDocument​(java.lang.String fileName,
                                                      boolean waitForTermination)
                                               throws java.io.IOException
        Prints a PDF document.
        Parameters:
        fileName - the name of the file to print
        waitForTermination - true to wait for termination, false otherwise
        Returns:
        a process
        Throws:
        java.io.IOException - on error
      • printDocument

        public static java.lang.Process printDocument​(java.io.File file,
                                                      boolean waitForTermination)
                                               throws java.io.IOException
        Prints a PDF document.
        Parameters:
        file - the File to print
        waitForTermination - true to wait for termination, false otherwise
        Returns:
        a process
        Throws:
        java.io.IOException - on error
      • printDocument

        public static java.lang.Process printDocument​(java.lang.String fileName)
                                               throws java.io.IOException
        Prints a PDF document.
        Parameters:
        fileName - the name of the file to print
        Returns:
        a process
        Throws:
        java.io.IOException - on error
      • printDocument

        public static java.lang.Process printDocument​(java.io.File file)
                                               throws java.io.IOException
        Prints a PDF document.
        Parameters:
        file - the File to print
        Returns:
        a process
        Throws:
        java.io.IOException - on error
      • printDocumentSilent

        public static java.lang.Process printDocumentSilent​(java.lang.String fileName,
                                                            boolean waitForTermination)
                                                     throws java.io.IOException
        Prints a PDF document without opening a Dialog box.
        Parameters:
        fileName - the name of the file to print
        waitForTermination - true to wait for termination, false otherwise
        Returns:
        a process
        Throws:
        java.io.IOException - on error
      • printDocumentSilent

        public static java.lang.Process printDocumentSilent​(java.io.File file,
                                                            boolean waitForTermination)
                                                     throws java.io.IOException
        Prints a PDF document without opening a Dialog box.
        Parameters:
        file - the File to print
        waitForTermination - true to wait for termination, false otherwise
        Returns:
        a process
        Throws:
        java.io.IOException - on error
      • printDocumentSilent

        public static java.lang.Process printDocumentSilent​(java.lang.String fileName)
                                                     throws java.io.IOException
        Prints a PDF document without opening a Dialog box.
        Parameters:
        fileName - the name of the file to print
        Returns:
        a process
        Throws:
        java.io.IOException - on error
      • printDocumentSilent

        public static java.lang.Process printDocumentSilent​(java.io.File file)
                                                     throws java.io.IOException
        Prints a PDF document without opening a Dialog box.
        Parameters:
        file - the File to print
        Returns:
        a process
        Throws:
        java.io.IOException - on error
      • launchBrowser

        public static void launchBrowser​(java.lang.String url)
                                  throws java.io.IOException
        Launches a browser opening an URL.
        Parameters:
        url - the URL you want to open in the browser
        Throws:
        java.io.IOException - on error
      • isWindows

        public static boolean isWindows()
        Checks the Operating System.
        Returns:
        true if the current os is Windows
      • isWindows9X

        public static boolean isWindows9X()
        Checks the Operating System.
        Returns:
        true if the current os is Windows
      • isMac

        public static boolean isMac()
        Checks the Operating System.
        Returns:
        true if the current os is Apple
      • isLinux

        public static boolean isLinux()
        Checks the Operating System.
        Returns:
        true if the current os is Linux