?
Solved

How to find Tomcat initial memory and Max memory through command line windows

Posted on 2016-08-02
12
Medium Priority
?
415 Views
Last Modified: 2016-08-22
Hi,
We have the tomcat variables set in the tomcatw.exe  JAVA options on windows, but I want to get the Java Initial memory and Java Max memory settings results in command line.

I tried jinfo -flags pid and catalina.exe version

Please help me with the command to get the initial memory and max memory pool settings of a tomcat instance.

Thanks
0
Comment
Question by:DevSupport
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 

Author Comment

by:DevSupport
ID: 41740026
I am attaching the screenshots of the values which I am trying to retrieve through command line in windows, if my question is not clear enough.

Any help would be highly appreciated!.

Thanks
xmx-and-xms-settings-of-tomcat.jpg
0
 

Author Comment

by:DevSupport
ID: 41744447
May I know why this question is neglected? Is there no way to accomplish this? or is my question not clear enough?

Thanks
0
 
LVL 28

Expert Comment

by:rrz
ID: 41744886
I have been listening. I don't have a solution. I do wonder if you know about Tomcat's pre-installed manager app ? If you click on the "Server Status" button on Tomcat's home page, then you will see memory usage info(if you entered name and password in tomcat-users.xml file). Although that proves that the info can be obtained programmatically, I don't know how it is done.  I realize that you wanted to access the info on command line. I don't know about that.
1
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 21

Expert Comment

by:Amitkumar Panchal
ID: 41745152
Hi,

Give it a try with wmic + find command.

wmic process | find "java" | find "catalina"

Open in new window


I tried in my computer (on Win 7) and i can able to get the information (refer attached snap).

Basically, please play with wmic process command and check the list of processes it displays. Then
You may need to add more text to find specific (tomcat) process from the list if you multiple java processes are running.

Hope it helps.
0
 

Author Comment

by:DevSupport
ID: 41748843
I tried it in a single java application instance with tomcat 8 and its not working
0
 
LVL 21

Expert Comment

by:Amitkumar Panchal
ID: 41748880
On a command window, can run below command (by keeping tomcat running) and share generated text file ?

wmic process >> processes.txt
0
 

Author Comment

by:DevSupport
ID: 41748947
Please find attached result. I took this while tomcat is running as a service.
0
 
LVL 21

Expert Comment

by:Amitkumar Panchal
ID: 41748992
Seems you missed to attach a file.
0
 

Author Comment

by:DevSupport
ID: 41749138
Sorry! Here it is.

Thanks
processes-results.txt
0
 

Accepted Solution

by:
Roger Wilko earned 1000 total points
ID: 41762894
Hi,

first, I am not a Windows expert, but probably the easiest way is to query the registry as these values are stored there. On Windows 2008 R2 server, the java params are stored within the following key(s):

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation

Open in new window


So getting the values needed, use the command "REQ QUERY":

REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation" /s /f "JvmM" 

Open in new window


The output will look like this:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\tomcat06\Parameters\Java 
    JvmMs    REG_DWORD    0x400 
    JvmMx    REG_DWORD    0x800 

Open in new window


This is an example for a tomcat instance called "tomcat06".  Having more instances will result in an extended output, but anyway you will need to parse the output. The "REG_DWORD" value is stored in HEX, so there is a need to convert it. In this case JvmMs (initial Ram) => 1024 MB and JvmMx (max Ram) => 2048.

Specifying  the "/f" filter, can narrow down the output.

I am pretty sure, you can manage to parse the output via powershell or even batch. My expertise would be more unix orientated parsing languages.

Greetings
0
 
LVL 21

Assisted Solution

by:Amitkumar Panchal
Amitkumar Panchal earned 1000 total points
ID: 41762920
Agree with Roger. This one is better than I suggested. Here, we don't require tomcat to be started.
0
 

Author Closing Comment

by:DevSupport
ID: 41765342
The response from Roger worked really well for my requirement. Thank You!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
Suggested Courses
Course of the Month11 days, 6 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question