Linux system tips (4): Introduction to the environment variable JAVA_TOOL_OPTIONS

Summary: For applications that use Java through JNI, such as using JNI to call the JVM. To pass parameters to the JVM, the environment variable JAVA_TOOL_OPTIONS is probably your only option.

The official documentation about this environment variable is here, and I don't need to talk about it, but it seems that many people don't know this variable and its documentation. In order to spread the meter, or record it.

First of all, although the word "TOOL" is in the variable name, its role is "JAVA_OPTIONS". It's just a coincidence that the name doesn't live up to the truth.

Usually used to see the impact of the java command line. For example, such

20150323144010201_jpeg

Of course, good practice is also essential, for example, Java VM Options You Should Always Use in Production.

However, occasionally there is still such a situation, as mentioned in the official documents above, there are still times when adjustments are needed, for example, to adjust the jvm configuration, but you have no way to pass the configuration file (may be your own compiled jdk) or java command line option to do this.

For example, Impala: Real-time Query for Hadoop, which has a daemon process, is a C++ program that uses JNI directly and calls libjvm.so. Searching the official website and checking the source code did not find a configuration method. In this case, the only way to pass parameters to the JVM started by Impala is to use the JAVA_TOOL_OPTIONS environment variable.

By convention, to give an example

export JAVA_TOOL_OPTIONS=' -Xss2m'
This article is the original content of the Yunqi community and cannot be reproduced without permission. If you need to reprint, please send an email to [email protected]; if you find any content suspected of plagiarism in this community, please send an email to: yqgroup@ service.aliyun.com reports and provides relevant evidence. Once verified, the community will immediately delete the allegedly infringing content.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326172289&siteId=291194637
Recommended