How to read max stack size -Xss that is set/default for a java program?

I need to know what is the maximum stack size i.e. -Xss my java program is running with.

Is there a way to find that out from inside my java program code and outside of it.

What i am looking for is to read whatever the current set max limit -Xss (stack sie) is for a particular JVM(not Operating System) i.e. PID; be it default or set explicitly using -Xss parameter, from inside a unix shell script or a java program inorder to setup a monitoring alert script.
A third-party tool may also come handy only if we can use its API inorder to read the stack size inside the unix shell script or a java program.

Kindly help !!!

Regards,
Mohtashim

---------- Post updated at 08:28 PM ---------- Previous update was at 02:52 AM ----------

Ooops ... Did I post this in the wrong forum, or we do not have answers on this yet ?

---------- Post updated at 08:28 PM ---------- Previous update was at 08:28 PM ----------

Ooops ... Did I post this in the wrong forum, or we do not have answers on this yet ?

---------- Post updated at 08:28 PM ---------- Previous update was at 08:28 PM ----------

Ooops ... Did I post this in the wrong forum, or we do not have answers on this yet ?

Add a JMX remote stanza to your start up script, you can then connect with JConsole which will give you all the start up options the JVM is running with. If there is no -Xss setting the default is 512K for Solaris and 1M for Linux and this will apply in the absence of an explicit setting.

SkryneSaver Hi,

Thanks for your inputs here. Can you give me specifics of the JMX remote stanza. Also I wish to read the Xss value inside a unix shell script or a java program. It will be more than help if you could let me know how-to.

Sun have extensive docs on monitoring a process, JConsole isn't amenable to being scripted unfortunately