Search code examples
javaembedding

Passing java options to libjvm


My code uses a library which loads libjvm.so in order to embed some java code, essentially running the JVM within my process.

AFAIK normally when running with the java executable, one passes options through the command line arguments, Is there an equivalent when embedding libjvm?

I have already tried to use the JAVA_OPTS environment variable, but without success. Is there another way? Maybe even a "canonical" way?


Solution

  • After some digging around, I have found that although JAVA_OPTS does not work, there is another environment variable called JAVA_TOOL_OPTIONS which is part of the JVMTI and seems to do the trick.

    For more information take a look here