Howto Display JVM Option in code

J

julien

Hi.

I try to display in my application the options of the jvm. To verify
and eventually adapt the process.

In fact i want a code that display for example :

JVM Arguments
-Xms:128
-Xmx:128
etc

Thanks for any help
 
S

sameergn

Hi.

I try to display in my application the options of the jvm. To verify
and eventually adapt the process.

In fact i want a code that display for example :

JVM Arguments
-Xms:128
-Xmx:128
etc

Thanks for any help

I don't think these options are exposed via any API. Indirectly, you
can use Runtime.maxMemory() to get -Xmx parameter.
 
C

Chris Uppal

julien said:
I try to display in my application the options of the jvm. To verify
and eventually adapt the process.

As far as I know, that is not possible. I would /love/ to be proved wrong...

-- chris
 
T

Tom Hawtin

Chris said:
As far as I know, that is not possible. I would /love/ to be proved wrong...

Well, jinfo shows the information. So you could either duplicate parts
of jinfo (which presumably connects to a
debugging/performance/monitoring & management interface) or do something
platform specific, such as run /bin/ps.

But generally you can't change these things at runtime.

Tom Hawtin
 
P

Piotr Kobzda

Tom said:
Well, jinfo shows the information. So you could either duplicate parts
of jinfo (which presumably connects to a
debugging/performance/monitoring & management interface) or do something
platform specific, such as run /bin/ps.

jinfo is /presumably/ using that:

<http://java.sun.com/javase/6/docs/api/java/lang/management/RuntimeMXBean.html#getInputArguments()>

For current JVM, it's one line of code to have that info:

ManagementFactory.getRuntimeMXBean().getInputArguments()


piotr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top