File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Detect -X options Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Detect -X options" Watch "Detect -X options" New topic
Author

Detect -X options

Victor Ho
Ranch Hand

Joined: Sep 05, 2003
Posts: 74
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
Layne Lund
Ranch Hand

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


Java API Documentation
The Java Tutorial
Victor Ho
Ranch Hand

Joined: Sep 05, 2003
Posts: 74
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

Joined: Dec 06, 2001
Posts: 3061
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Detect -X options
 
Similar Threads
x
JDeveloper exam..
how to config Tomcat on windows NT
WA #1.....word association
Trying out smilies