# Get the current instance of PApplet from a library

**URL:** <https://discourse.processing.org/t/get-the-current-instance-of-papplet-from-a-library/36925>\
**Category:** Coding Questions\
**Created:** [May 17, 2022, 4:55pm UTC](https://discourse.processing.org/t/get-the-current-instance-of-papplet-from-a-library/36925 "2022-05-17T16:55:37Z")\
**Posts on this page:** 1\
**Showing post:** 25

<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:** [September 24, 2022, 5:30pm UTC](https://discourse.processing.org/t/get-the-current-instance-of-papplet-from-a-library/36925/25 "2022-09-24T17:30:08Z")

</div>

> [@NumericPrime](#):
>
> Java 17 made the .setAccessible methods for the java.lang.\* classes not work anymore.

Since Java 9 method [**setAccessible()**](https://docs.oracle.com/javase/9/docs/api/java/lang/reflect/AccessibleObject.html#setAccessible-boolean-) also takes into consideration the module a reflected member belongs to:

> **[Java Platform Module System | Properties of modules](https://en.wikipedia.org/wiki/Java_Platform_Module_System#Properties_of_modules)**
>
> Modules are a new way of grouping code. Contrary to Jar files, modules explicitly declare which modules they depend on, and what packages they export. Explicit dependency declarations improve the integrity of the code, by making it easier to reason about large applications and the dependencies between software components.
> The module declaration is placed in a file named module-info.java at the root of the module’s source-file hierarchy. The JDK will verify dependencies and interactions between m...

There’s an `--add-opens` option for the Java’s command-line, but dunno how to add that to Processing:  
[OpenJDK.org/jeps/261#Breaking-encapsulation](http://OpenJDK.org/jeps/261#Breaking-encapsulation)

---

_[View the full topic](https://discourse.processing.org/t/get-the-current-instance-of-papplet-from-a-library/36925)._
