-
Notifications
You must be signed in to change notification settings - Fork 91
Using POSIX with Java Modules
Charles Oliver Nutter edited this page Jun 6, 2024
·
1 revision
The jnr-posix library requires reflective access to some core Java classes in order to support several native operations:
- The real process ID (pid) inside java.lang.Process
- The real file descriptor inside java.io.FileDescriptor
When running on a Java version that limits reflective operations across Java modules, these accesses may fail and cripple other parts of the API.
If you are running with jnr-posix on the normal Java classpath, the following command line flags should open up these packages:
java --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED <rest of command line>
If you run with jnr-posix as a module (using --module-path
) change ALL-UNNAMED
to org.jnrproject.posix
.