Under Linux, I have a Java process and one of it's plugins depends on libgtk-*.so
shared library. Currently we use $LD_LIBRARY_PATH
or $LD_PRELOAD
to set the path to this shared library. But if the Java process opens subprocesses, then they will also have those envs set, which lead to unwanted results.
In any other programming language (such as Python), I would just unset those two envs once the Java process is started running. But it looks like Java does not let you a way to modify envs in runtime.
Is it possible to provide the shared library as one of the Java arguments? Any other way to set this shared library only for the Java process and not for any subprocess?