title: Running a Quartz job with Java class name stored in database
body: <p>I have a two jobs in Quartz which will run perfetly well but I find I have to use code like:</p>
  
  <pre><code>jd = new JobDetail(sj.getJobName(), scheduler.DEFAULT_GROUP, PollJob.class);
  ct = new CronTrigger(sj.getJobTrigger(), scheduler.DEFAULT_GROUP, "0 20 * * * ?");
          scheduler.scheduleJob(jd, ct);
  </code></pre>
  
  <p>I have to hardcode PollJob.class to run the job and sj is an object read from the database containing PollJob's details. But I would like to set PollJob.class from the database as well. I've tried casting to a class by:</p>
  
  <pre><code>Class cls = Class.forName(sj.getJobJavaClassFile());
  jd = new JobDetail(sj.getJobName(), scheduler.DEFAULT_GROUP, cls));
  </code></pre>
  
  <p>And using a class reference directly as:</p>
  
  <pre><code>    jd = new JobDetail(sj.getJobName(), scheduler.DEFAULT_GROUP, Class.forName sj.getJobJavaClassFile()));
  </code></pre>
  
  <p>But the job simply doesn't execute. There are no exceptions generated that I can see and no stack trace?</p>
  
  <p>I'm running a JVM on Windows 7.</p>
  
  <p>Any ideas?</p>
  
  <p>Mr Morgan.</p>