Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the java gadgets?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Java widgets have what, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this can learn, I hope you can gain something.

Friends who often do Java development, whether it is pure back-end development or Java Web development, there are some operations you will encounter frequently. For example:

I've seen a lot of people at work who want to see what Java applications are currently running either through Process Manager (Windows) or using

ps -ef |grep java (command line under Linux). These are used to obtain a list of running Java applications and the corresponding PID (process ID).

While viewing heap memory, you may download some third-party tools and so on.

In fact, JDK has default comes with some small tools, very easy to use, easy to use. If you don't believe me, look at the following:

jps (Java Virtual Mathine Process Status Tool)

You can tell by the name. The main thing is to list the state of Java processes.

This command can specify the hosted, which lists Java processes on the remote host.

This command has a few parameters, and I usually have

-l Output the full package name of the application's main class, or the full path to the application JAR file.

-v Output parameters passed to JVM.

Generally, all Java processes can be listed locally through jps -lv, as well as parameters passed to the JVM and file locations run. In this way, the first two problems above a command are solved.

2. jinfo (Java Configuration Info)

It is mainly used to view some configuration parameters used by Java processes, such as how much heap memory is set, and whether to allow dumping heap information when OOM is generated.

In addition, the command can also dynamically change the configuration of items, such as the above mentioned OOM dump switch is off, it can be run when it is turned on.

3. jstate (Java Virtual Machine Statistics Monitoring Tool)

There are many options for this command. According to different options, you can count different data that you are interested in. For example, if you are interested in JVM garbage collection data, you can directly view it by specifying-gc, while a more commonly used option is-gcutil.

Of course, JDK comes with a lot of small tools, take the above tools as an example, the latter two in the execution, both need to know the JVM PID before execution, after all, these tools need to know which JVM you want to see.

Here's a quick overview of how jps works.

Each JVM, after startup, is essentially a process of the operating system and has a PID value associated with it. The internal implementation of JVM is to create a file with the PID of the current JVM as the file name in a local directory after each startup. The file path is related to the operating system. The path under Windows 7 is

C:\Users\{this is your username}\AppData\Local\Temp\hsperfdata_{this is also your username}

In this directory, all PID files corresponding to the JVMs you are running under are here.

In the same way, if you've ever used JConsole(which is also a gadget that comes with JDK), you'll probably feel it right away. Because it also reads the file information under this directory to get the required data, you see the following Jconsole new connection diagram, these PID just correspond to the file above is not.

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report