# Error: NullPointerException

**URL:** <https://discourse.processing.org/t/error-nullpointerexception/27251>\
**Category:** Coding Questions\
**Created:** [January 20, 2021, 8:55pm UTC](https://discourse.processing.org/t/error-nullpointerexception/27251 "2021-01-20T20:55:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![christiank79](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/christiank79/32/11861_2.png) [@christiank79](https://discourse.processing.org/u/christiank79)\
**Post date:** [January 20, 2021, 8:55pm UTC](https://discourse.processing.org/t/error-nullpointerexception/27251/1 "2021-01-20T20:55:26Z")

</div>

Hello,  
I have a problem to solve this coding in Java in 16th line, show me an error: NullPointerException. What can I do? Below is the code:

```auto
import processing.svg.*;
PImage img;
float theta= 31;
float k = 11;
float r = 500;
float x1, x2;
float y1, y2;
float RATE=1;
 
void setup() {
  frameRate(5);
  size(800, 800);
  strokeWeight(5);
  beginRecord(SVG, "draw.svg"); 
  img = loadImage("IMG3936.jpg");
  image(img, 338, 450); //image(img, 0, 0);
  x1= cos(k*theta)*cos(theta)*r+width/2;
  y1= cos(k*theta)*sin(theta)*r+height/2;
}
 
void draw() {
  theta += RATE;
  x2= cos(k*theta)*cos(theta)*r+width/2;
  y2= cos(k*theta)*sin(theta)*r+height/2;
  line(x1, y1, x2, y2);
  x1=x2;
  y1=y2;
 
}
void keyPressed() {
  if (key == 'q') {
    endRecord();
    exit();
  }
}

```

Thank you.

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [January 20, 2021, 9:36pm UTC](https://discourse.processing.org/t/error-nullpointerexception/27251/2 "2021-01-20T21:36:44Z")

</div>

> [@christiank79](#):
>
> n 16th line,

This line image(img, 338, 450); ?

Then loading of img didn’t work. Check if e.g. the spelling on the Hard Drive is correct for ` "IMG3936.jpg"`, it’s case sensitive or whether it’s jpg or JPG or even .jpg.jpg

Thank you!
