Example usage for java.lang System getProperties

List of usage examples for java.lang System getProperties

Introduction

In this page you can find the example usage for java.lang System getProperties.

Prototype

public static Properties getProperties() 

Source Link

Document

Determines the current system properties.

Usage

From source file:com.enonic.cms.core.boot.HomeResolver.java

public HomeResolver() {
    setSystemProperties(System.getProperties());
    setEnvironment(System.getenv());
    setDefaultHome(new File(SystemUtils.getUserHome(), "cms-home"));
}

From source file:com.vmware.bdd.utils.Configuration.java

private static org.apache.commons.configuration.Configuration init() {
    org.apache.commons.configuration.Configuration config = null;
    String homeDir = System.getProperties().getProperty("serengeti.home.dir");
    String configFileName = null;
    if (homeDir != null && homeDir.length() > 0) {
        StringBuilder builder = new StringBuilder();
        builder.append(homeDir).append(File.separator).append("conf").append(File.separator)
                .append("serengeti.properties");
        configFileName = builder.toString();
    } else {/*from w  w  w.  jav a  2 s.  c  om*/
        configFileName = "serengeti.properties";
    }
    try {
        logger.info("Reading properties file serengeti.properties");
        config = new PropertiesConfiguration(configFileName);
    } catch (ConfigurationException ex) {
        // error out if the configuration file is not there
        String message = "Failed to load serengeti configuration file: " + configFileName;
        logger.fatal(message, ex);
        throw BddException.APP_INIT_ERROR(ex, message);
    }
    logConfig(config);
    return config;
}

From source file:com.robin.utilities.config.RobinConfiguration.java

public RobinConfiguration() {
    properties = System.getProperties();

    baseDir = new File(properties.getProperty("basedir"));
    if (baseDir == null) {
        baseDir = new File(".");
    }//from  w ww  .j a  v  a  2s  .  c  om

    addConfigFile(ROBIN_PROPERTIES);
    addConfigFileIfExists(BUILD_PROPERTIES);

    if (properties.getProperty(ConfigParams.MIN_DEVICE_TO_USE) == null) {
        properties.setProperty(ConfigParams.MIN_DEVICE_TO_USE, "1");
    }
}

From source file:com.kuzumeji.platform.standard.SystemHelperTest.java

@Test
public final void testSystem() {
    final Properties property = System.getProperties();
    for (final Entry<Object, Object> entry : property.entrySet()) {
        LOG.debug("{} : {}", entry.getKey(), entry.getValue());
    }//from ww w  .jav  a  2  s  .  co m
}

From source file:com.metratech.metanga.api.impl.ClientHttpRequestFactorySelector.java

public static ClientHttpRequestFactory getRequestFactory() {
    Properties properties = System.getProperties();
    String proxyHost = properties.getProperty("http.proxyHost");
    int proxyPort = properties.containsKey("http.proxyPort")
            ? Integer.valueOf(properties.getProperty("http.proxyPort"))
            : 80;/*  ww w .  j a v  a 2  s.c om*/
    if (HTTP_COMPONENTS_AVAILABLE) {
        return HttpComponentsClientRequestFactoryCreator.createRequestFactory(proxyHost, proxyPort);
    } else {
        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
        if (proxyHost != null) {
            requestFactory.setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort)));
        }
        return requestFactory;
    }
}

From source file:Main.java

public static double getJavaVersion() {
    if (javaVersion == null) {
        try {/*from   w  w w.  jav a  2s . c  o  m*/
            String ver = System.getProperties().getProperty("java.version");
            String version = "";
            boolean firstPoint = true;
            for (int i = 0; i < ver.length(); i++) {
                if (ver.charAt(i) == '.') {
                    if (firstPoint) {
                        version += ver.charAt(i);
                    }
                    firstPoint = false;
                } else if (Character.isDigit(ver.charAt(i))) {
                    version += ver.charAt(i);
                }
            }
            javaVersion = new Double(version);
        } catch (Exception ex) {
            javaVersion = new Double(1.3);
        }
    }
    return javaVersion.doubleValue();
}

From source file:com.adaptris.core.management.ProxyAuthenticator.java

private static String getSystemProperty(String[] keys) {
    for (String key : keys) {
        if (System.getProperties().containsKey(key)) {
            return System.getProperty(key);
        }//from ww w .  j a v  a2 s. co  m
    }
    return null;
}

From source file:com.egt.core.util.VelocityEngineer.java

private static Properties getProperties(String propsFilename) throws Exception {
    Bitacora.trace(VelocityEngineer.class, "getProperties", propsFilename);
    Properties p = new Properties();
    try (FileInputStream inStream = new FileInputStream(propsFilename)) {
        p.load(inStream);//from   w w  w. j  a  v  a2s  .  c o  m
    }
    String comma = System.getProperties().getProperty("path.separator");
    String slash = System.getProperties().getProperty("file.separator");
    String VFRLP = "$" + EAC.VELOCITY_FILE_RESOURCE_LOADER_PATH;
    String vfrlp = EA.getString(EAC.VELOCITY_FILE_RESOURCE_LOADER_PATH);
    vfrlp = vfrlp.replace(comma, ", ");
    vfrlp = vfrlp.replace(slash, "/");
    String key;
    String value;
    for (Enumeration e = p.propertyNames(); e.hasMoreElements();) {
        key = (String) e.nextElement();
        value = p.getProperty(key);
        if (StringUtils.isNotBlank(value) && value.contains(VFRLP)) {
            value = value.replace(VFRLP, vfrlp);
            p.setProperty(key, value);
        }
        Bitacora.trace(key + "=" + value);
    }
    return p;
}

From source file:com.aw.core.report.ReportFileGenerator.java

public static void main(String[] a) {
    System.out.println("" + System.getProperties());
}

From source file:OperatingSystem.java

public static String javaVersion() {
    return "Java " + System.getProperties().getProperty("java.version");
}