Here you can find the source of detectFilePath(String propertyName, String confFileName)
private static String detectFilePath(String propertyName, String confFileName)
//package com.java2s; //License from project: Apache License import java.io.File; import java.nio.file.Paths; public class Main { private static final String CONF_DIR = "conf"; private static String detectFilePath(String propertyName, String confFileName) { String configFilePath = System.getProperty(propertyName); if (configFilePath == null) { String currentDir = Paths.get(".").toAbsolutePath().normalize().toString(); File confDir = new File(currentDir, CONF_DIR); if (confDir.exists() && confDir.isDirectory() && confDir.canRead()) { File dbConfigFile = new File(confDir, confFileName); if (dbConfigFile.exists()) { configFilePath = dbConfigFile.getAbsolutePath(); }//from w w w .ja va 2 s .c om } } else { File dbConfigFile = new File(configFilePath); configFilePath = dbConfigFile.getAbsolutePath(); } return configFilePath; } }