4 Replies Latest reply: Aug 14, 2009 2:10 PM by 807580 RSS

    Set and Get property value from different java file

    807580
      Hi,

      I am using setProperty in one java file. When I am going to get that properth value from another java file, I am getting the null value. I have posted sample below. Please anyone advise me to solve this points.

      PropertySetting.java
      public class PropertySetting {
          public static void main(String ar[]){
              System.setProperty("name", "senthil");
              System.out.println("Name "+System.getProperty("name"));
          }
      }
      PropertyGetting.java
      public class PropertyGetting {
          public static void main(String ar[]){
              System.out.println("Name: "+System.getProperty("name"));
          }
      }
      Thanks
      Senthil