
org.jerkar.tool.JkUtilsTool Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Build simpler, stronger, faster
package org.jerkar.tool;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import org.jerkar.api.system.JkLocator;
import org.jerkar.api.utils.JkUtilsFile;
/**
* Utilities related to running piece of code outside of the tool itself.
*/
public final class JkUtilsTool {
static Map userSystemProperties() {
final Map result = new HashMap();
final File userPropFile = new File(JkLocator.jerkarUserHome(), "system.properties");
if (userPropFile.exists()) {
result.putAll(JkUtilsFile.readPropertyFileAsMap(userPropFile));
}
return result;
}
static void setSystemProperties(Map props) {
for (final Map.Entry entry : props.entrySet()) {
System.setProperty(entry.getKey(), entry.getValue());
}
}
/**
* Set the properties defined in Jerkar user directory into the system.
*/
public static void loadUserSystemProperties() {
setSystemProperties(userSystemProperties());
}
private JkUtilsTool() {
// Can't instantiate
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy