This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes getting list of JRE args Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "getting list of JRE args" Watch "getting list of JRE args" New topic
Author

getting list of JRE args

D Preethi
Ranch Hand

Joined: May 24, 2008
Posts: 68
Hi All,

I have a scenario in which I am passing a list of jre args to my application, and based on some of the jre args, i need to have some logic in my application to execute some code.

Is there any API which could help me get the list of all JRE args that I passed to my application when I started it up?


Thanks in advance,
Preethi
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

How about the String[] argument to your public static void main method?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2835
    
  11

Rob, I think he's talking about parameters given to the JVM, not the application parameters.

"D", any parameters of the form -Dproperty=value can be retrieved through System.getProperties(). 99% of the time, that's all you need. If you are in that last 1%, take a look at RuntimeMXBean in the Java API. It might be able to give you the information you need.
 
jQuery in Action, 2nd edition
 
subject: getting list of JRE args
 
Similar Threads
Information regarding Jar files
Packaged application in java
How can I distribute my Java desktop application?
Code to get JRE version
JDK , JRE Update