title: Velocity ResourceNotFoundException in IntelliJ IDEA
body: <p>I have a Velocity template <strong>ValueTmpl.vm</strong> which can't be found by the Velocity ResourceManager. A minimal example:</p>
  
  <pre><code>package generate;
  
  import java.io.File;
  import java.io.FileWriter;
  import java.io.Writer;
  import org.apache.velocity.app.Velocity;
  import org.apache.velocity.app.VelocityEngine;
  import org.apache.velocity.Template;
  import org.apache.velocity.VelocityContext;
  
  public class Generate {
      public static void main(String[] args) throws Exception {
          VelocityContext context = new VelocityContext();
          context.put("key", "value");
          Writer writer = new FileWriter(new File("Result.java"));
          createTemplate("generate/templates/ValueTmpl.vm").merge(context, writer);
          writer.close();
      }
  
      private static Template createTemplate(String vmTemplateFile) {
          VelocityEngine ve = new VelocityEngine();
          ve.setProperty(Velocity.RESOURCE_LOADER, "class");
          ve.setProperty("class.resource.loader.class",
                  "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
          ve.init();
          return ve.getTemplate(vmTemplateFile);
      }
  }
  </code></pre>
  
  <p>The <strong>generate</strong> folder is in the root of the <strong>src</strong> directory. I get the following error:</p>
  
  <pre><code>21.03.2011 13:09:01 org.apache.velocity.runtime.log.JdkLogChute log
  SEVERE: ResourceManager : unable to find resource 'generate/templates/ValueTmpl.vm' in any resource loader.
  Exception in thread "main" org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'generate/templates/ValueTmpl.vm'
  </code></pre>
  
  <p>Does someone know what the problem can be? Should I change something in the project settings?</p>
  
  <p>Thanks in advance!</p>