java bash: jstat: 命令未找到
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30525862/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
bash: jstat: command not found
提问by Kumar Saras
I want to use the gc utility to analyse the garbage collection for my Cassandra database. But when I am running jstat command the output comes that bash:jstat: command not found. I searched and found that jstat is located in $JAVA_HOME/bin but I am not able to understand where is $JAVA_HOME/bin. I want to know how to start using jstat?
我想使用 gc 实用程序来分析我的 Cassandra 数据库的垃圾收集。但是当我运行 jstat 命令时,输出是 bash:jstat: command not found。我搜索并发现 jstat 位于 $JAVA_HOME/bin 中,但我无法理解 $JAVA_HOME/bin 在哪里。我想知道如何开始使用 jstat?
回答by Shriram
jstat
is a tool which is available in jdk (development environment). If your application is using jre then only the tools under jre/bin will be available in your execution environment.
Make sure to use jdk as your execution environment to use jstat
tool.
jstat
是jdk(开发环境)中提供的工具。如果您的应用程序正在使用 jre,那么您的执行环境中将只能使用 jre/bin 下的工具。确保使用 jdk 作为您的执行环境来使用jstat
工具。
回答by arifng
To see $JAVA_HOME
path, you have to run the following command:
要查看$JAVA_HOME
路径,您必须运行以下命令:
echo $JAVA_HOME
回声 $JAVA_HOME
It will print java home directory path.
它将打印 java 主目录路径。
To run jstat
, you have to go to $JAVA_HOME/bin
path and run the following command:
要运行jstat
,您必须转到$JAVA_HOME/bin
路径并运行以下命令:
./jstat -gc 29563
./jstat -gc 29563
Note: gc
is option (there are more options) and 29563
is java process ID. see oracle documentfor details.
注意:gc
is 选项(有更多选项)和29563
java 进程 ID。有关详细信息,请参阅oracle 文档。