Setting up JConsole to see Java memory usage

  • 7020637
  • 15-Jul-2016
  • 07-Aug-2017


Java 8
Retain for Windows
Retain for Linux


I would like to see how Java is using memory on my Retain server on Windows and Linux.  Is there a utility that provides that?


The Java Monitoring & Management Console (JConsole)  is a tool designed to see how much memory usage, CPU usage, threads and other monitoring tasks for JAVA applicatins, such as Retain Tomcat. 


You must configure the Retain Tomcat service in JAVA before being able to see the it within JConsole. 

  1. Launch Configure Tomcat.
  2. Click on the Java tab.
  3. In the Java Options window, add these parameters:

  1. Ok the changes and restart the Retain Tomcat service.

Tip:  You can change the port from 9010 to anything you want by changing the the port parameter. If port 9010 is in use, you can change it to something different. Restart Retain Tomcat service after you have changed it, or you will not be able to connect. 

If you want to see which ports are in use, or listening, go to a command prompt and type netstat -abno. 

  1. Open a command window.
  2. Change to the Java JDK's bin directory:  [drive]:\Program Files\Beginfinite\Retain\Java8\jdk1.[version]\lib
  3. Launch jconsole by typing jconsole.jar and presssing ENTER.

This will launch the Java Monitoring and Management Console (JConsole)

7.In the Remote Process:  field type in localhost: (or ipaddress of server) and the port number specified in the paramters (9010). i.e. localhost:9010. Don't forget the colon after the localhost, and don't add any spaces in between them either. 

Ignore the Username and Password and click connect. This will connect to the JConsole. 


The JConsole for Linux can only be run on using a GUI. 

To setup JConsole with Linux follow these steps:

  1. Go to  the /etc directory
  2. Edit profile (vi profile)
  3. Look for the section: make path more comfortable and go to the bottom where it reads: export PATH=
  4.  Type: export PATH=$PATH:/opt/beginfinite/retain/java8/jdk1.8.0_60/bin/ Save the file. 

This will make it so that you can run JAVA without having to go to the JAVA bin directory. 

To setup to monitor JAVA and Tomcat: 

  1. Navigate to /opt/beginfinite/retain/tomcat7/bin
  2. Edit the file
  3. Copy the following lines to the top of the file. Found that the easiest place was just after the comments section.  


9. Save the file.

10. Restart Tomcat

11. Go to /opt/beginfinite/java/java8/jdk1.8.0_60/lib

12.Type java –jar jconsole.jar

13.Enter in the field localhost (or ipaddress): 9010 i.e. localhost:9010

Additional Information

This article was originally published in the GWAVA knowledgebase as article ID 2830.