• Post Reply Bookmark Topic Watch Topic
  • New Topic

using jconsole

 
Alex Teslin
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have difficulties to use jconsole. For example i can enable the JMX agent for my application with the command:
java -Dcom.sun.management.jmxremote MY_APPLICATION
and it runs the application.

Reading 'using jconsole' material which says to run jconsole - just type jconsole PID, where PID is Process ID that i am getting from Task Manager.

I know i am missing the main concept here, but i don't understand how and when to run jconsole, because PID i can get while the Application is running and while is running i can not type anything in the command line.

Can anyone explain what am I missing please?

Thank you
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have two main options here. You can simply open another command window, and start JConsole from that. Or, you can start your java application in the background, so that you can use the same window to start JConsole. In unix, you'd do this by appending & at the end of the command line:

java MyApp &

The command will return almost immediately, printing the PID to the screen. MyApp is still running in the background - for as long as it normally runs, anyway.

I don't remember how to do this (run in background) in a standard Windows environment, as I almost always use cygwin (a Unix emulator) when I'm on Windows. But someone else probably knows...
 
Alex Teslin
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for that.

I am running from a second window and works fine now.

Thanks again
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!