webrev: http://cr.openjdk.java.net/~shemnon/RT-37767/webrev.0/
Jira: https://javafx-jira.kenai.com/browse/RT-37767
This is the proposed API to allow the friendly access tot eh User JVM Options.
Here are some snippets from demo code on my machine showing how they may
interact:
// get the helper instance
UserJvmOptions ujo = UserJvmOptions.getUserJVMDefaults();
Map<String, String> userOptions = ujo.getUserJVMOptions();
// print out all the options currently set
for (Map.Entry <String, String> entry : userOptions.entrySet()) {
System.out.println("key:" + entry.getKey() + " value:" +
entry.getValue());
}
// if we haven't marked the first run, do so now
if (!userOptions.containsKey("-DfirstRunMs")) {
userOptions.put("-DfirstRunMs",
Long.toString(System.currentTimeMillis()));
}
// add the last run
userOptions.put("-DlastRunMs",
Long.toString(System.currentTimeMillis()));
// save the changes
ujo.setUserJVMOptions(userOptions);
----
// create a table row with Key, Current Value, and Default Value
DefaultTableModel model = new DefaultTableModel();
model.addColumn("Key");
model.addColumn("Effective");
model.addColumn("Default");
Map<String, String> defaults = ujo.getUserJVMOptionDefaults();
for (Map.Entry <String, String> entry : userOptions.entrySet()) {
// get the default, it may be null
String def = defaults.get(entry.getKey());
model.addRow(new Object[] {entry.getKey(), entry.getValue(), def ==
null ? "<no default>" : def});
}