【发布时间】:2013-06-01 10:08:47
【问题描述】:
我做的步骤:
我在代码中做
System.setProperty("myproperty", 1);
然后我在 shell 脚本中将属性“myProperty”设置为 3。 像这样:
# setprop "myproperty" 3
然后在代码中我尝试像这样读取属性:
System.getProperty("myproperty");
我得到的值为 1。这意味着 shell 中的设置实际上并没有工作。 但是当我用
从 shell 打印所有道具时# getprop
我在列表中看到 myproperty 等于 3。
简而言之:我想从脚本中更改属性的值,我看到这个脚本实际上更改了属性,但在 java 代码中我得到了旧值。
有什么想法吗?
【问题讨论】:
-
System.getProperty("myProperty")与System.getProperty("myproperty")不同。 -
@kocko 这不是问题,我只是在这里打错了。
-
@LeeMeador 我说的是安卓