Howto Display JVM Option in code

Discussion in 'Java' started by julien, Mar 6, 2007.

  1. julien

    julien Guest

    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
    julien, Mar 6, 2007
    #1
    1. Advertising

  2. julien

    Guest

    On Mar 6, 3:22 pm, "julien" <> 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.
    , Mar 7, 2007
    #2
    1. Advertising

  3. julien

    Chris Uppal Guest

    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
    Chris Uppal, Mar 7, 2007
    #3
  4. julien

    Tom Hawtin Guest

    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
    Tom Hawtin, Mar 7, 2007
    #4
  5. julien

    Piotr Kobzda Guest

    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().getInputArguments()


    piotr
    Piotr Kobzda, Mar 7, 2007
    #5
  6. julien

    Chris Uppal Guest

    Piotr Kobzda wrote:

    > ManagementFactory.getRuntimeMXBean().getInputArguments()


    Nice!

    -- chris
    Chris Uppal, Mar 7, 2007
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Hooke

    Re: Handling both MS JVM and Sun JVM

    Kevin Hooke, Aug 26, 2003, in forum: Java
    Replies:
    2
    Views:
    864
  2. Lasse
    Replies:
    1
    Views:
    682
    Jon A. Cruz
    Jan 5, 2004
  3. Young-Jin Lee

    MS JVM and Sun JVM problem

    Young-Jin Lee, Jan 20, 2004, in forum: Java
    Replies:
    3
    Views:
    563
    Mickey Segal
    Jan 21, 2004
  4. Julien ROUZIERES

    g++ -pg option and -shared option

    Julien ROUZIERES, Dec 21, 2004, in forum: C++
    Replies:
    1
    Views:
    703
    GianGuz
    Dec 21, 2004
  5. Replies:
    0
    Views:
    1,428
Loading...

Share This Page