# Running a Processing 4 PApplet in Eclipse IDE

**URL:** https://discourse.processing.org/t/running-a-processing-4-papplet-in-eclipse-ide/44792
**Category:** Libraries
**Created:** [July 21, 2024, 4:58pm UTC](https://discourse.processing.org/t/running-a-processing-4-papplet-in-eclipse-ide/44792 "2024-07-21T16:58:27Z")
**Posts on this page:** 1
**Showing post:** 11

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [July 22, 2024, 4:17pm UTC](https://discourse.processing.org/t/running-a-processing-4-papplet-in-eclipse-ide/44792/11 "2024-07-22T16:17:32Z")

</div>

An example of using **runSketch()** in the PDE in order to have a separate PGraphics on a separate thread:

> [@Problems when trying to draw to a P3D PGraphics when called from a thread?](https://discourse.processing.org/t/problems-when-trying-to-draw-to-a-p3d-pgraphics-when-called-from-a-thread/6301/4):
>
> Although it’s pretty much a hack, here’s the workaround I’ve come up w/: crazy_face /\*\* \* Threaded PGraphics II (v1.0.1) \* GoToLoop (2018/Dec/07) \* \* https://Discourse.Processing.org/t/ \* problems-when-trying-to-draw-to-a-p3d-pgraphics- \* when-called-from-a-thread/6301/4 \* \* https://Forum.Processing.org/two/discussion/25799/ \* how-to-draw-a-rect-in-a-thread#Item\_2 \*/ static final int W = 250, H = 200, FPS = 10; Layer layer; void settings() { size(W, H, JAVA2D); smooth(3); } v…

We config ARGS\_SKETCH\_FOLDER " --sketch-path" to match PApplet’s main sketch, so save functions know the root folder where the sketch is run:

```auto
final String[] switches = { ARGS_SKETCH_FOLDER + sketchPath(), "" };
runSketch(switches, layer = new Layer());

```

Layer is the 2nd PApplet subclass:

```auto
public static class Layer extends PApplet {
  static final short INTERVAL = 1*1000, TXT_SIZE = 40;
  static final float BOLD = 2.5;
  static final color BORDER = 0, TXT_COLOR = -1;

  PGraphics pg;
  PImage img;

  void settings() {
    size(1, 1, P2D);
  }

```

---

_[View the full topic](https://discourse.processing.org/t/running-a-processing-4-papplet-in-eclipse-ide/44792)._
