Here you can find the source of getFileSystemProperty(String name)
public static File getFileSystemProperty(String name)
//package com.java2s; //License from project: Apache License import java.io.File; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static final Pattern VAR_PTN = Pattern.compile("\\$\\{([^\\}]+)\\}"); public static File getFileSystemProperty(String name) { return getFileSystemProperty(name, null); }/* ww w.j a v a 2s. c o m*/ public static File getFileSystemProperty(String name, File defaultFile) { String fileStr = replace(System.getProperty(name)); if (fileStr != null) return new File(fileStr); else return defaultFile; } private static String replace(String value) { if (value == null) return null; StringBuffer sb = new StringBuffer(256); Matcher m = VAR_PTN.matcher(value); while (m.find()) { String propValue = System.getProperty(m.group(1)); if (propValue == null) propValue = ""; m.appendReplacement(sb, Matcher.quoteReplacement(propValue)); } m.appendTail(sb); return sb.toString(); } }