Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

Howto Display JVM Option in code

Thread view: 
julien - 06 Mar 2007 23:22 GMT
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
sameergn@gmail.com - 07 Mar 2007 01:42 GMT
> Hi.
>
[quoted text clipped - 9 lines]
>
> 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.
Chris Uppal - 07 Mar 2007 04:46 GMT
> 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
Tom Hawtin - 07 Mar 2007 05:26 GMT
>> 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
Piotr Kobzda - 07 Mar 2007 08:19 GMT
>>> I try to display in my application the options of the jvm. To verify
>>> and eventually adapt the process.
[quoted text clipped - 6 lines]
> 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#ge
tInputArguments
()>

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

   ManagementFactory.getRuntimeMXBean().getInputArguments()

piotr
Chris Uppal - 07 Mar 2007 12:46 GMT
>     ManagementFactory.getRuntimeMXBean().getInputArguments()

Nice!

   -- chris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.