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.
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.
Joined: Dec 06, 2001
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.