Import Java.io.ioexception;import java.io.inputstream;import java.util.properties;/** * The use of the Properties class, The use of this class can be easily taken to the contents of the configuration file * We can read the configuration * systemconfig.getproperty ("name") directly by invoking the following method in other classes. * @author Leejuen * */public class Systemconfig {private static Properties systemconfig;private static String configpath;p Rivate systemconfig () {}static{systemconfig = new Properties (); Configpath = "./sys-config.properties"; Set the profile path try {/** * When using Class.getresourceasstream, the resource path has two ways, * one with/start, then the path is a specified absolute path, if not with/start, the path is relative to the package containing the class When using Classloader.getresourceasstream, the * path uses the absolute path relative to classpath directly. */class classconfig = Class.forName ("Com.szkingdom.leejuen.SystemConfig"); InputStream is = Classconfig.getresourceasstream (Configpath);//inputstream is = new FileInputStream ("Sys-config.properties"); Systemconfig.load (IS);} catch (IOException e) {//Todo auto-generated catch Blocke.printstacktrace ();} catch (ClassNotFoundException e) {//Todo A Uto-generated catch Blocke.printstacktrace ();}} PubliC Static string GetProperty (String key) {return Systemconfig.getproperty (key);}}