apparition
asked on
Reading paramters passed to JVM
I would like to pass a paramter into the JVM and have my code read it. So for example on the start up script for my app server I would pass a paramter like -Dprop.dir="some/dir". How would I go about doing something like this ?
String property = System.getProperty("prop.d ir");
ASKER
I tried this in eclipse but get an erro
java.lang.NoClassDefFoundE rror: =
Exception in thread "main"
here is the code
public class ReadParam {
/**
* @param args
*/
public static void main(String[] args) {
String home = System.getProperty("config .dir");
System.out.println(home);
}
}
When I run it I pass the following parameters in eclipse VM parameter box
-Dconfig.dir = "aasda"
java.lang.NoClassDefFoundE
Exception in thread "main"
here is the code
public class ReadParam {
/**
* @param args
*/
public static void main(String[] args) {
String home = System.getProperty("config
System.out.println(home);
}
}
When I run it I pass the following parameters in eclipse VM parameter box
-Dconfig.dir = "aasda"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.