Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2016-08-02
12
Medium Priority
?
584 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
Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

 
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

For anyone that has accidentally used newSID with Server 2008 R2 (like I did) and hasn't been able to get the server running again because you were unlucky (as I was) and had no backups - I was able to get things working by doing a Registry Hive rec…
Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

610 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