• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get the status and memory usage in Javsa

 
Thirumurugan Sivaji
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have two text fields in my JSP called ipAddress and processName. When I click the submit button I have to find and get the status of the Process and memory usage in bytes and also in percentage for that particular process name.Can anyone give me the Java code for performing the above task that support all Operating System.

 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thirumurugan Sivaji wrote:Hi,
I have two text fields in my JSP called ipAddress and processName. When I click the submit button I have to find and get the status of the Process and memory usage in bytes and also in percentage for that particular process name.Can anyone give me the Java code for performing the above task that support all Operating System.



Hi Thirumurgan,

The CodeRanch is Not a Code Mill. We can try to help you solve your problems, but we will not provide full solutions. If you want full solutions there are consultancy services you can look into to get the work done.

The question you ask, in particular, is a difficult one, because it will depend on what information each OS provides. The method for getting that information is most likely OS dependent, and may require native code. One approach on Windows would be to call "tasklist.exe" from Runtime.exec(), which provides a list of the running processes and their memory consumption. Parse the results and you should get the answer you are looking for. Other OSes will have different tools, and I am not convinced all versions of Windows have tasklist.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic