Class System


  • public class System
    extends java.lang.Object
    Functions for executing shell commands on the local operating system and other system-level operations.
    Since:
    8 Jun 2005
    Author:
    Mark Taylor (Starlink)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String exec​(java.lang.Object... words)
      Executes an operating system command composed of a command and one or more arguments.
      static java.lang.String exec​(java.lang.String line)
      Executes a string as an operating system command.
      static void sleep​(int secs)
      Waits for a specified number of seconds.
      static void sleepMillis​(int millis)
      Waits for a specified number of milliseconds.
      • Methods inherited from class java.lang.Object

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

      • exec

        public static java.lang.String exec​(java.lang.Object... words)
        Executes an operating system command composed of a command and one or more arguments.

        Each of the words values is treated as a single (possibly quoted) word in a shell command. The first argument is the filename (either a full pathname, or the name of a file on the current path) of an executable file. These values can be numeric, or strings, or something else, and are converted automatically to string values.

        Parameters:
        words - one or more words composing a shell command; first is command and others are arguments
        Returns:
        short report message
        Examples:
        exec("/home/mbt/bin/process_obj.py", OBJ_NAME), exec("process_skycoords.py", RA, DEC), exec("process_sphericalcoords.sh", RA, DEC, 1.0)
      • exec

        public static java.lang.String exec​(java.lang.String line)
        Executes a string as an operating system command. Any spaces in the string are taken to delimit words (the first word is the name of the command).
        Parameters:
        line - command line to execute
        Returns:
        short report message
        Examples:
        exec("do_stuff.py " + RA + " " + DEC)
      • sleepMillis

        public static void sleepMillis​(int millis)
        Waits for a specified number of milliseconds.
        Parameters:
        millis - number of milliseconds to wait
      • sleep

        public static void sleep​(int secs)
        Waits for a specified number of seconds.
        Parameters:
        secs - number of seconds to wait