title: Windows batch script unable to find the path for library through windows scheduler
body: <p>I have a java program which connects to my database and verify some reports and send out an email to the specific mail ids. And there is one batch script which calls this java class. This java class requires javax.activation.jar, javax_mail.jar, ojdbc14.jar which I Kept along with batch and java file in some folder. </p>
  
  <p>When I run the program by executing the batch script directly from the path where it lies the program works and send out emails. </p>
  
  <p>But now I have scheduled this batch script to run every one hour using the windows scheduler. At that point there is compilation error for my java saying unable to find the required dependent classes.</p>
  
  <p>My batch file looks like this.</p>
  
  <pre><code>@echo off
  
  cd D:\CPP\scheduler\JOB_REPORTS_MAIL
  D:
  
  :: compile the Main class and helper classes
  javac Constants.java
  javac DBUtility.java
  javac -cp ".;javax.activation.jar;javax_mail.jar;ojdbc14.jar" SendJobStatusEmail.java
  javac -cp ".;javax.activation.jar;javax_mail.jar;ojdbc14.jar" JobReportScheduler.java
  
  
  :: Run the Main class
  java -cp ".;javax.activation.jar;javax_mail.jar;ojdbc14.jar" JobReportScheduler
  </code></pre>
  
  <p>If I remove the below lines from my batch its not able to run through the windows scheduler</p>
  
  <pre><code>cd D:\CPP\scheduler\JOB_REPORTS_MAIL
  D:
  </code></pre>
  
  <p>I want to remove these two lines. WHen the scheduler picks the batch file and executes it it should be able to pick the dpendent jars from lib folder under the directory where the batch stays. </p>
  
  <p>It should not be dependent on the machine where, in which drive it it so that I can put in any windows machine and execute using windows scheduler. </p>
  
  <p>I tried different options nothing works. PLease help me here.</p>