title: Detect if java is run from cron or through shell
body: <p>How to detect if java is run from cron or through interactive shell. </p>
  
  <p>I need to determine if the script is called by a user (show error message in sys.out) or cron(send error as email)</p>