AFAIK, there is no system-wide way to set JVM flags for all Java processes. There are various environment variables that are conventionally used by 3rd-party tools. Some of them are described here:
However, these do not apply when you launch an application directly using the java command.
The "jvm.cfg" file does not help. It implements an (undocumented) mechanism for configuring the java command's "known JVMs" and the JVM options that select them. (For details, refer to src/java.base/share/native/libjli/java.c in the OpenJDK 11 source tree.)
This leaves you with clunky / kludgy / fragile alternatives like:
- defining
java as a shell function or alias
- writing a wrapper script for the
java command and putting it on your PATH ahead of the real java binary.