Swaranga Sarma
Swaranga Sarma

Reputation: 13393

Java code to check for JVM options

Can any one help me with some referenes as to how I can check different values passed to the JVM. For example if I invoke the jvm with the following options "-Djava.library.path=lib", how do I check what is passed as library arguments to the JVM.

Upvotes: 2

Views: 867

Answers (1)

Laurence Gonsalves
Laurence Gonsalves

Reputation: 143064

The things set by the -D flag are called sytem properties. You can retrieve them using System.getProperty. eg:

System.getProperty("java.library.path")

There are a few other methods in System that may be of interest you you, like System.getProperties which returns the entire set of system properties.

Note that there are some system properties that will have values even without being set by the -D flag.

Upvotes: 4

Related Questions