Tuesday, November 19, 2013

Get user home and java home with Java code

To get user home and java home, call System.getProperty() method with parameter of "user.home" or "java.home".

user home and java home
user home and java home

package java_systemproperty;

/**
 *
 * @web http://java-buddy.blogspot.com/
 */
public class Java_SystemProperty {

    public static void main(String[] args) {
        System.out.println("user.home: " + System.getProperty("user.home"));
        System.out.println("java.home: " + System.getProperty("java.home"));
    }
    
}


No comments:

Post a Comment