# Closing only PApplet with exit() code

**URL:** <https://discourse.processing.org/t/closing-only-papplet-with-exit-code/18591>\
**Category:** Coding Questions\
**Created:** [March 11, 2020, 10:08am UTC](https://discourse.processing.org/t/closing-only-papplet-with-exit-code/18591 "2020-03-11T10:08:36Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![micycle](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micycle/32/201_2.png) [@micycle](https://discourse.processing.org/u/micycle)\
**Post date:** [March 17, 2020, 9:33am UTC](https://discourse.processing.org/t/closing-only-papplet-with-exit-code/18591/6 "2020-03-17T09:33:11Z")

</div>

> [@Prevent one Processing window from closing others](https://discourse.processing.org/t/prevent-one-processing-window-from-closing-others/13719/5):
>
> I’ve done some digging – inspired by @GoToLoop and @quark – and have found a solution. Closing sketches in P2D and JAVA2D renderer modes calls the PApplet instance’s exitActual() method, which contains the line System.exit(0) – a static method – which terminates the currently running Java virtual machine. Overriding exitActual() with nothing (i.e. preventing the call to System.exit(0)) prevents sketches from closing others, fixing the issue, but introduces another problem in the case of P2D s…

---

_[View the full topic](https://discourse.processing.org/t/closing-only-papplet-with-exit-code/18591)._
