/ Published in: Java

current function
* list all system properties
* list a specific property
* list all system properties
* list a specific property
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import java.util.Properties; import java.util.Scanner; public class SysPropsTool { //props = System.getProperties(); usageInfo(); while (true) { try { if (line == null || line.length() < 1) { continue; } if (QUIT.equals(preStic) || QUIT_.equals(preStic)) { break; } if (HELP.equals(preStic) || HELP_.equals(preStic) || HELP__.equals(preStic)) { usageInfo(); continue; } boolean isList = LIST.equals(preStic) || LIST_.equals(preStic) || LISTALL.equals(preStic); if (isList) { showAll(); }else { showIndivl(line); } usageInfo(); } } } static void showAll () { if (props != null) { } } StringBuilder info = new StringBuilder(key); info.append("=").append(value); } return props.getProperty(key); } props.setProperty(key, value); return props; } static void usageInfo () { System.out.println("[Usage]: \n\t [/q|/quit]:\t to quit \n\t [/ls|/list|/all]:\t to list all props \n\t {key}:\t get the key-value \n\t [/h|/?|/help]:\t for help"); } }
Comments
