# Could not run the sketch.( Target VM failed to initialize)

**URL:** <https://discourse.processing.org/t/could-not-run-the-sketch-target-vm-failed-to-initialize/14280>\
**Category:** Coding Questions\
**Created:** [September 29, 2019, 1:52pm UTC](https://discourse.processing.org/t/could-not-run-the-sketch-target-vm-failed-to-initialize/14280 "2019-09-29T13:52:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yangms3302](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yangms3302/32/6610_2.png) [@yangms3302](https://discourse.processing.org/u/yangms3302)\
**Post date:** [September 29, 2019, 1:52pm UTC](https://discourse.processing.org/t/could-not-run-the-sketch-target-vm-failed-to-initialize/14280/1 "2019-09-29T13:52:22Z")

</div>

Hi. I am getting this error message every time I run a code. I put jpg file in the sketch file folder in ‘data’ folder, and already tried several times. Here is a code:  
PImage img;

void setup() {  
size(640, 360);  
frameRate(30);  
img = loadImage(“rock.jpg”);  
img.loadPixels();  
loadPixels();  
}

void draw() {  
for (int x = 0; x \< img.width; x++) {  
for (int y = 0; y \< img.height; y++ ) {  
int loc = x + y_img.width;  
float r,g,b;  
r = red (img.pixels[loc]);  
float maxdist = 50;  
float d = dist(x, y, mouseX, mouseY);  
float adjustbrightness = 255_(maxdist-d)/maxdist;  
r += adjustbrightness;  
r = constrain(r, 0, 255);  
color c = color®;  
pixels[y\*width + x] = c;  
}  
}  
updatePixels();  
}

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [September 29, 2019, 2:30pm UTC](https://discourse.processing.org/t/could-not-run-the-sketch-target-vm-failed-to-initialize/14280/2 "2019-09-29T14:30:13Z")

</div>

-a- please post your code into the  
`</> Preformatted text` from the editor menu  
yours is too much damaged to run.

-b- after some repair and use a

```auto
  img = loadImage("moonwalk.jpg");

```

from the examples your code works, where you get it from?

-c- can you run any sketch from the examples?
