The example of this article tells the way Java read the Properties file. Share it for everyone for your reference. The specific analysis is as follows:
1. Not read in the project:
Properties Properties = New Properties (); bufferedReader Read = new bufferedReader (New InputStreamReader perties.load (read); Properties .GetProperty ("That file "key")
2. Read in the project:
InputStream InputStream = The class name of your tool class .class.getResourceASSTREAM ("/file name .prperties"); Properties P = New Properties (); TRY {P.Load (InputStream); I nputstream.close ();} Catch ( IoException E1) {e1.printstacktrace ();}
They all obtain Value's Value through P.Getproperty (key in the configuration file)
It is hoped that this article is helpful to everyone's Java program design.