title: Bash Script unable to run Java Program as cron job
body: <p>I am trying to run a .class file from a bash script every 1 minute using the crontab. I get the error Could not find or load main class Cron_Read_Send_CapacityData_To_Graphite. I have already set environment variable on my machine.</p>
  
  <p>If i run the bash script from the terminal it works fine.Note the bash script and the java class file are in the same folder</p>
  
  <p>Script:</p>
  
  <pre><code>$ cat Run_Cron_Read_Send_CapacityData_To_Graphite.sh
  #!/bin/bash
  
  java Cron_Read_Send_CapacityData_To_Graphite &gt;&gt; /home/marshell/graphite_cronjobs/Cron_Read_Send_CapacityData_To_Graphite.log
  </code></pre>
  
  <p>Cron entry:</p>
  
  <pre><code>$ crontab -e
  
  */1 * * * * /home/marshell/graphite_cronjobs/Run_Cron_Read_Send_CapacityData_To_Graphite.sh &gt;&gt; /home/marshell/graphite_cronjobs/debug_cronjob.log 2&gt;&amp;1
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Error: Could not find or load main class Cron_Read_Send_CapacityData_To_Graphite
  </code></pre>