# Identical code works in Processing IDE, but not from VS Code/CLI

**URL:** <https://discourse.processing.org/t/identical-code-works-in-processing-ide-but-not-from-vs-code-cli/40124>\
**Category:** Coding Questions\
**Created:** [December 11, 2022, 9:45pm UTC](https://discourse.processing.org/t/identical-code-works-in-processing-ide-but-not-from-vs-code-cli/40124 "2022-12-11T21:45:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blasphemy](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@blasphemy](https://discourse.processing.org/u/blasphemy)\
**Post date:** [December 11, 2022, 9:45pm UTC](https://discourse.processing.org/t/identical-code-works-in-processing-ide-but-not-from-vs-code-cli/40124/1 "2022-12-11T21:45:23Z")

</div>

I was going through this example from the website: [Array 2D / Examples / Processing.org](https://processing.org/examples/array2d.html) and I had no problem running it with the pre-built processing IDE. The file can also be run using CLI once saved to sketchbook.

```auto
adam@gandalf:~/sketchbook/practice$ processing-java --sketch=./sketch_2d_arrays_test --run
Finished.

```

However, when I manually create a .pde file, edit it in vscode, paste in identical code from the link above and try to run it from CLI, I get this error:

```auto
adam@gandalf:~/sketchbook/practice$ processing-java --sketch=./2d_array_test_vscode --run
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at processing.app.Sketch.getMainName(Sketch.java:1699)
	at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:144)
	at processing.mode.java.JavaBuild.build(JavaBuild.java:110)
	at processing.mode.java.Commander.<init>(Commander.java:233)
	at processing.mode.java.Commander.main(Commander.java:417)

```

Is there a step that I’m missing here? Both files contain exactly the same code, the only difference being that I created one manually, while the other was created and saved out using the Processing IDE.

 ![Screenshot from 2022-12-11 15-45-07](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/c/e/ce46bac1d1c373018a3c62abd570f6aa14a60f27.png)

---

<div class="post-metadata">

**Author:** ![blasphemy](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@blasphemy](https://discourse.processing.org/u/blasphemy)\
**Post date:** [December 11, 2022, 10:40pm UTC](https://discourse.processing.org/t/identical-code-works-in-processing-ide-but-not-from-vs-code-cli/40124/2 "2022-12-11T22:40:12Z")

</div>

I think I’ve figured out the issue! Turns out this error will occur if you start the name of the sketch with a number. The processing IDE automatically adds the sketch\_ prefix to sketches that you save, which is why the error happened when I used vscode, but not when I used the IDE.

---

<div class="post-metadata">

**Author:** ![cami](https://avatars.discourse-cdn.com/v4/letter/c/c6cbf5/32.png) [@cami](https://discourse.processing.org/u/cami)\
**Post date:** [May 10, 2024, 7:29am UTC](https://discourse.processing.org/t/identical-code-works-in-processing-ide-but-not-from-vs-code-cli/40124/3 "2024-05-10T07:29:57Z")

</div>

I had the same problem when trying to launch a processing project via Terminal (on Ubuntu 22) or via Sublime Text.

Renaming the project without a number as first character solved the issue, thanks !
