Example usage for java.lang System setProperty

List of usage examples for java.lang System setProperty

Introduction

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

Prototype

public static String setProperty(String key, String value) 

Source Link

Document

Sets the system property indicated by the specified key.

Usage

From source file:Main.java

/**
 * @see http://stackoverflow.com/questions/2529682/setting-user-agent-of-a-java-urlconnection
 *///w  ww .j ava  2 s  .c om
public static void enableUserAgentOverwrite() {
    System.setProperty("http.agent", "");
}

From source file:Main.java

public static void initAntiAliasing() {
    System.setProperty("awt.useSystemAAFontSettings", "lcd");
    System.setProperty("swing.aatext", "true");
}

From source file:Main.java

/**
 * This will returns the instance of the STAX XMLOutputFactory and will initialze the properties to the factory.
 *
 * @return This will return the instance of STAX XMLOutputFactory.
 *//*w  ww .  j  av a2  s.c o  m*/
public static XMLOutputFactory getStaxOutputFactory() {

    if (staxOutputFactory == null) {
        try {
            // These should be taken from either properties file or from command line arguments.
            System.setProperty("javax.xml.stream.XMLOutputFactory", "com.ctc.wstx.stax.WstxOutputFactory");
            staxOutputFactory = XMLOutputFactory.newInstance();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    return staxOutputFactory;
}

From source file:com.netflix.config.DefaultDeploymentContextTest.java

@BeforeClass
public static void init() {
    System.setProperty(ConfigurationBasedDeploymentContext.DEPLOYMENT_REGION_PROPERTY, "us-east-1");
}

From source file:com.netflix.config.ConfigurationManagerInitClassTest.java

@BeforeClass
public static void init() {
    System.setProperty("archaius.default.configuration.class", "com.netflix.config.TestConfiguration");
}

From source file:fedora.utilities.Log4J.java

/**
 * Forces commons-logging to use Log4J.//from ww  w.  j  a v a  2s . co m
 * <p>
 * This should only be called from standalone applications,
 * and must be called before any attempt is made to configure
 * or use commons-logging or Log4J.
 */
public static void force() {
    System.setProperty("org.apache.commons.logging.LogFactory", "org.apache.commons.logging.impl.Log4jFactory");
    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Log4JLogger");
}

From source file:org.wgrus.ServletConfigurationTests.java

@BeforeClass
public static void init() {
    System.setProperty("spring.profiles.default", "default");
}

From source file:com.netflix.config.ConfigurationManagerInitFactoryTest.java

@BeforeClass
public static void init() {
    System.setProperty("archaius.default.configuration.factory", "com.netflix.config.TestConfigurationFactory");
}

From source file:Main.java

/**
 * Workaround for bug pre-Froyo, see here for more info:
 * http://android-developers.blogspot.com/2011/09/androids-http-clients.html
 *///from   w w w  .  j  a v a2  s  . com
public static void disableConnectionReuseIfNecessary() {
    // HTTP connection reuse which was buggy pre-froyo
    if (hasHttpConnectionBug()) {
        System.setProperty("http.keepAlive", "false");
    }
}

From source file:com.google.oacurl.util.LoggingConfig.java

public static void init(boolean verbose) throws SecurityException, IOException {
    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger");

    Logger defaultLogger = Logger.getLogger("");
    if (verbose) {
        defaultLogger.setLevel(Level.INFO);
    } else {//from  w  w  w. ja  v  a2s  .c o m
        defaultLogger.setLevel(Level.SEVERE);
    }
}