• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 753
  • Last Modified:

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 ?
  • 2
1 Solution
String property = System.getProperty("prop.dir");
apparitionAuthor Commented:
I tried this in eclipse but get an erro
java.lang.NoClassDefFoundError: =
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");


When I run it I pass the following parameters in eclipse VM parameter box
-Dconfig.dir = "aasda"

> -Dconfig.dir = "aasda"

should be:

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now