title: I am unable to draw image on Canvas in J2ME
body: <p>I am try to load image on Canvas but it giving <code>java.io.IOException exception</code>. I don't know in which folder i have to put image. but right now i am putting image in F<code>:\New Folder\DrawImage\src\Waterfall.png.</code> i am using netbean editor for coding. reference code from <a href="http://www.java2s.com/Tutorial/Java/0430__J2ME/Drawimage.htm" rel="nofollow">here</a></p>
  
  <p><code>public class Midlet extends MIDlet {</code></p>
  
  <pre><code>public Display display;
  
  public void startApp() {
  
      Canvas obj = new DrawImage();
  
      display = Display.getDisplay(this);
      display.setCurrent(obj);
  
  }
  
  public void pauseApp() {
  }
  
  public void destroyApp(boolean unconditional) {
  }
  
  public class DrawImage extends Canvas{
  
      int width = getWidth();
      int height = getHeight();
  
      protected void paint(Graphics g) {
          try {
  
              System.out.println("111111");
              Image image = Image.createImage("/Waterfall.png");
              if(image != null)
                  g.drawImage(image, 0, 0, Graphics.TOP | Graphics.LEFT);
              else
                  System.out.println("2222");
          } catch (IOException ex) {
              System.out.println(ex);
          }   
      }  
  }
  </code></pre>
  
  <p>}</p>