Class Shell

  • Direct Known Subclasses:
    CygwinShell, NativeShell

    public abstract class Shell
    extends java.lang.Object
    Author:
    Nils Geilen Provides several ways to run unix commands on different OSes.
    • Constructor Summary

      Constructors 
      Constructor Description
      Shell()  
    • Method Summary

      Modifier and Type Method Description
      static Shell getCygwinShell​(java.lang.String binary)
      a wrapper around the cygwin shell
      static Shell getNativeShell()
      a wrapper for the os' native shell
      abstract java.lang.String run​(java.lang.String cmd)
      runs command
      • Methods inherited from class java.lang.Object

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

      • Shell

        public Shell()
    • Method Detail

      • getNativeShell

        public static Shell getNativeShell()
        a wrapper for the os' native shell
        Returns:
        a wrapper for the os' native shell
      • getCygwinShell

        public static Shell getCygwinShell​(java.lang.String binary)
        a wrapper around the cygwin shell
        Parameters:
        binary - path to bash.exe
        Returns:
        a wrapper for the os' native shell
      • run

        public abstract java.lang.String run​(java.lang.String cmd)
                                      throws java.lang.InterruptedException,
                                             java.io.IOException
        runs command
        Parameters:
        cmd - the command to be run
        Returns:
        the terminal output
        Throws:
        java.lang.InterruptedException - if some interruption occurred.
        java.io.IOException - if some IO issue occurred.