使用 System.getProperty(String strKey)
我如何得到一个属性文件的全路径呢?
参数给什么?

解决方案 »

  1.   

    属性文件的全路径 ?? 那跟System.getProperty有什么关系啊
      

  2.   

    我读到别人的程序中的一句话:
    String ls_props = System.getProperty(PKEY_RPTCTRL_PROPS);
    其中 protected static final String PKEY_RPTCTRL_PROPS = "rptctrl.props";
      

  3.   

    我不知道这种用法,我只知道用Properties.load(inputstream)来读取Prop文件
    定位prop文件全路径,用File.getAbsolutePath();
      

  4.   

    除了用Properties.load(inputstream) 来load文件外,还有一种办法可以加property:当你运行java时用-D参数, 比如:java -Dtest=ttt MyClass这样你在MyClass.java中可以用System.getProperty("test")得到ttt