Mega Code Archive

 
Categories / Java Tutorial / Development
 

Using System getProperty(String key) to retrieve system properties

This method returns the value of the specified property. It returns null if the specified property does not exist. Each property comes as a key/value pair. There are system properties and user-defined properties. When a Java program runs, the JVM provides values that may be used by the program as properties. For example, the os.name system property provides the name of the operating system running the JVM. To get the value of the user.dir property, you use: public class MainClass{   public static void main(String[] args){     System.out.println(System.getProperty ("user.dir"));         } } C:\Java_Dev\eclipse31\Apache Common