title: How do I get the correct value for sketchPath in IntelliJ IDEA?
body: <p>I want to setup IntelliJ IDEA to compile Processing sketches. So far I've been following the instructions found here:
  <a href="http://www.slideshare.net/eskimoblood/processing-in-intellij" rel="nofollow">http://www.slideshare.net/eskimoblood/processing-in-intellij</a></p>
  
  <p>These instructions work fine for code completion and basic "drawing". But I run into problems once I want to access files – i.e. an image - inside the data folder which is created on slide 19. First the code of my Processing class:</p>
  
  <pre><code>import processing.core.PApplet;
  import processing.core.PImage;
  
  public class IntellijTest extends PApplet
  {
      private PImage image;
  
      @Override
      public void setup() {
          size(400, 400);
          println(sketchPath);
          // load image
          image = loadImage("test.png");
      }
  
  
      @Override
      public void draw() {
          background(0);
          noStroke();
          fill(200);
          rect(100, 100, 200, 200);
          // draw image
          image(image, 110, 100);
      }
  }
  </code></pre>
  
  <p>This leads to the following error:</p>
  
  <pre><code>/Applications/IntelliJ IDEA 12.app/bin
  The file "test.png" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
  Exception in thread "Animation Thread" java.lang.NullPointerException
      at processing.core.PGraphics.image(PGraphics.java:3572)
      at processing.core.PApplet.image(PApplet.java:12604)
      at IntellijTest.draw(IntellijTest.java:28)
      at processing.core.PApplet.handleDraw(PApplet.java:2306)
      at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:243)
      at processing.core.PApplet.run(PApplet.java:2177)
      at java.lang.Thread.run(Thread.java:744)
  </code></pre>
  
  <p>As you can see the sketchPath is set to "/Applications/IntelliJ IDEA 12.app/bin". So the running sketch (Applet) does not find the image. IntelliJ does even warn me about it, but I still haven't figured out how to add the image to the sketch or better how to set the correct sketchPath value so that the sketch finds all files inside the data folder at runtime.</p>
  
  <p>I'ld really appreciate any hints or insights on how to accomplish this.</p>