我试图修改用户Java设置。我试图将安全性设置为MEDIUM
。
这是我到目前为止所做的,但它将其添加为另一个dict
。我想将它添加到已经存在的/com/oracle/javadeployment/
密钥中。
/usr/libexec/PlistBuddy \
-c "add ':/com/oracle/javadeployment/:deployment.security.level:' string MEDIUM" \
~/Library/Preferences/com.oracle.javadeployment.plist
我最终得到了这个:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>/com/oracle/javadeployment/</key>
<key>deployment.expiration.decision.10.51.2</key>
<string>later</string>
<key>deployment.expiration.decision.suppression.10.51.2</key>
<string>true</string>
<key>deployment.expired.version</key>
<string>10.51.2</string>
<key>deployment.log</key>
<string>true</string>
<key>deployment.modified.timestamp</key>
<string>1399690282571</string>
<key>deployment.version</key>
<string>7.21</string>
</dict>
<key>deployment.security.level</key>
<string>MEDIUM</string>
</dict>
</plist>
我想
<key>deployment.security.level</key>
<string>MEDIUM</string>
高于倒数第二个</dict>
。
我尝试过移动'
和"
,但我发现错误......
我尝试在密钥之间添加0
,并将其添加到dict
的顶部,但也将其放在自己的dict
中,当发生这种情况时不读取设置;它需要在密钥/com/oracle/javadeployment/
有什么建议吗?我已经在这里待了几个小时,我没有想法。
答案 0 :(得分:0)
deployment.security.level之后的尾随冒号是问题;它创造了一个字典。
您的命令并未完全生成问题中显示的结果,但我能够通过使用&#34;添加&deployment; security.security.level&#39;来获得您的输出。 string MEDIUM&#34; (这也是不正确的。)
以下适用于OS X 10.8.5:
/usr/libexec/PlistBuddy \
-c "add '/com/oracle/javadeployment/:deployment.security.level' string MEDIUM" \
~/Library/Preferences/com.oracle.javadeployment.plist
它产生:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>/com/oracle/javadeployment/</key>
<dict>
<key>deployment.expired.version</key>
<string>10.21.2</string>
<key>deployment.modified.timestamp</key>
<string>1388446189200</string>
<key>deployment.security.level</key>
<string>MEDIUM</string>
<key>deployment.version</key>
<string>7.21</string>
</dict>
</dict>
</plist>