Description of how to read and modify the properties file in Java: 1. properties getProperties (String filepath): Read the property file according to the path and return the Properties class; 2. void SaveProperties (Properties prop, String filepath): Save the property to the specified path (if the File does not exist, create a File first); 3. string getConfigValue (String key): Get the attribute of the specified Key; 4. void setConfigValue (String key, String value): sets the attribute value of the specified Key. The property file called in method 3 and 4 is the default file. The file name and path are set through CONFIG and LOCATION. The file is located under src in the project, export the jar file under the same directory (obtained by LOCATION ). The following code: [java] public class PropUtils {public static String LOCATION; public static final String CONFIG = "config. properties "; static {try {String temp = URLDecoder. decode (PropUtils. class. getProtectionDomain (). getCodeSource (). getLocation (). getFile (), "UTF-8"); LOCATION = temp. substring (1, temp. lastIndexOf ('/');} catch (UnsupportedEncodingException e) {LOCATION = "" ;}}/*** @ param args * @ thr Ows Exception */public static Properties getProperties (String filepath) throws Exception {Properties prop = new Properties (); FileInputStream FD = new FileInputStream (LOCATION + "/" + filepath); prop. load (FCM); return prop;} public static void SaveProperties (Properties prop, String filepath) throws Exception {FileOutputStream fos = new FileOutputStream (LOCATION + "/" + filepath); prop. store (fos, "@ aut Hor Isea533 "); fos. close ();} public static String getConfigValue (String key) {try {Properties properties = getProperties (CONFIG); if (properties. get (key )! = Null) {return properties. get (key ). toString () ;}} catch (Exception e) {System. out. println (e. getMessage ();} return "";} public static void setConfigValue (String key, String value) {try {Properties properties = getProperties (CONFIG); properties. setProperty (key, value); SaveProperties (properties, CONFIG);} catch (Exception e) {System. out. println (e. getMessage ());}}}