I started to study Tomcat source code today.
At the beginning, the init method in the startup class calls the system. getproperty and system. setproperty methods many times.
Later, I found out through online search that this is a method for operating system variable operations.
System also provides a static method system. getproperties (). This method can be used to list all the variables in your system.
The result of calling system. getproperties () is.
, Com. IBM. util. extralibs. properties =, Java. VM. specification. vendor = Sun Microsystems Inc ., user. variant =, Java. AWT. fonts =, OS. name = Windows XP, Sun. java2d. fontpath =, Java. jcl. version = 20081016a, Sun. JNU. encoding = cp1252, Java. library. path = C:/program files/IBM/java50/JRE/bin ;.; c:/program files/ThinkPad/utilities; C:/Windows/system32; C:/windows; C:/Windows/system32/WBEM; C: /program files/IBM/infoprint select; C:/notes; C:/program files/xlview; C:/Lotus/compnent; C:/utilities; C: /program files/IBM/Personal Communications/; C:/program files/IBM/Trace facility /;
Here, I can call system. getproperties ("OS. Name") to obtain Windows XP.
You can determine the operating system currently in use.
We can also use this method to obtain some classpath and some other required attributes.