Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Howto Display JVM Option in code

Reply
Thread Tools

Howto Display JVM Option in code

 
 
julien
Guest
Posts: n/a
 
      03-06-2007
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

 
Reply With Quote
 
 
 
 
sameergn@gmail.com
Guest
Posts: n/a
 
      03-07-2007
On Mar 6, 3:22 pm, "julien" <(E-Mail Removed)> wrote:
> 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.

 
Reply With Quote
 
 
 
 
Chris Uppal
Guest
Posts: n/a
 
      03-07-2007
julien wrote:

> 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


 
Reply With Quote
 
Tom Hawtin
Guest
Posts: n/a
 
      03-07-2007
Chris Uppal wrote:
> julien wrote:
>
>> 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...


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
 
Reply With Quote
 
Piotr Kobzda
Guest
Posts: n/a
 
      03-07-2007
Tom Hawtin wrote:
> Chris Uppal wrote:
>> julien wrote:
>>
>>> 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...

>
> 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().getInputArgum ents()


piotr
 
Reply With Quote
 
Chris Uppal
Guest
Posts: n/a
 
      03-07-2007
Piotr Kobzda wrote:

> ManagementFactory.getRuntimeMXBean().getInputArgum ents()


Nice!

-- chris


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sun's 1.5 JVM: the -XX:DefaultMaxRAM option and its cousins fredakers907@yahoo.com Java 0 12-12-2006 12:06 AM
g++ -pg option and -shared option Julien ROUZIERES C++ 1 12-21-2004 02:30 PM
MS JVM and Sun JVM problem Young-Jin Lee Java 3 01-21-2004 04:25 AM
Different behavior for newStringUTF() for Sun JVM and IBM Jvm Lasse Java 1 01-05-2004 07:49 PM
Re: Handling both MS JVM and Sun JVM Kevin Hooke Java 2 09-02-2003 05:31 AM



Advertisments