• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Detect -X options

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I want to find out if there is any programmatic interface to check if a particular -X option is specified when the JVM is launched.

Thanks
Victor
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My first guess is that you should check the String array that is passed as a parameter to main(). I'm not sure if these arguments are removed from the list before main() is called.

But why do you want to do this? The -X options are spcifically for the JVM. If your program wants command-line arguments, you should define your own set that can be taken from the String array passed to main(). If you can explain why you want to do this, perhaps it will make more sense to me.

Layne
 
Victor Ho
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Layne.

I have tried the String[] args to main(), but -X options are not included in the cmd-line args array.

I am using the native jvmdi interface (C APIs) in my program for self-debugging purposes. The trick about jvmdi is that it is only available if -Xdebug is specified when JVM is launched. I am looking for a way to automatically turn off the self-debugging feature if -Xdebug is not there.

Thanks
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doesn't the API provide a method to detect if debug information is available (i.e. this flag has been specified)? If not, that seems like a flaw in the API to me.

Layne
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic