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:com.mycompany.webcrawler.GmailAutomation.java

public static void main(String[] args) {
    System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
    DesiredCapabilities dcaps = new DesiredCapabilities();

    dcaps.setCapability("takeScreenshot", true);
    //WebDriver driver = new PhantomJSDriver(dcaps);

    //Comment for PhantomJS
    ChromeDriver driver = new ChromeDriver();

    //Comment for PhantomJS
    //driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);

    driver.get(//  w w  w.  ja va 2 s  .c  o m
            "https://accounts.google.com/ServiceLogin?sacu=1&scc=1&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&osid=1&service=mail&ss=1&ltmpl=default&rm=false#identifier");

    try {
        Thread.sleep(2000);

        driver.findElement(By.id("Email")).sendKeys("Your gmail goes here");

        Thread.sleep(2000);
        driver.findElement(By.id("next")).click();

        Thread.sleep(2000);
        driver.findElement(By.id("Passwd")).sendKeys("Your password goes here");

        Thread.sleep(2000);
        driver.findElement(By.id("signIn")).click();

        Thread.sleep(2000);
        driver.findElement(By.xpath("//div[@class='T-I J-J5-Ji T-I-KE L3']")).click();

        Thread.sleep(2000);
        driver.findElement(By.className("vO")).sendKeys("Who you want to send the email to");

        Thread.sleep(2000);
        driver.findElement(By.className("aoT")).sendKeys("The subject");

        Thread.sleep(2000);
        driver.switchTo().activeElement().sendKeys(Keys.TAB);
        driver.switchTo().activeElement().sendKeys("The body");

        //Comment for PhantomJS
        //driver.findElement(By.xpath("//div[@class='Am Al editable LW-avf']")).sendKeys("Test Email");

        Thread.sleep(2000);
        File file = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
        FileUtils.copyFile(file, new File("screenshot.jpg"));

        Thread.sleep(2000);
        driver.findElement(By.xpath("//div[@class='T-I J-J5-Ji aoO T-I-atl L3']")).click();

        //Comment for PhantomJS
        //Thread.sleep(2000);
        //driver.get("https://mail.google.com/mail/u/0/#sent");
    } catch (IOException | InterruptedException | WebDriverException e) {
        System.out.println(e.getMessage());
    }
}

From source file:TestJredis.java

public static void main(String[] args) {
    DOMConfigurator.configure(Config.DEFAULT_VALUE.FILE_PATH.LOG4J);

    System.setProperty("java.net.preferIPv4Stack", "true"); //Disable IPv6 in JVM
    /**?spring*//*from  w w  w.  ja v  a  2 s. co m*/
    //        BeanFactory springContext = new FileSystemXmlApplicationContext(Config.DEFAULT_VALUE.FILE_PATH.SPRING_CONFIG_PATH);
    //        TestJredis testJredis = (TestJredis) springContext.getBean("testJredis");
    //            ArrayList<Integer> list= new ArrayList<Integer>();
    //            list.add(1);
    //            list.add(2);
    //            list.add(3);
    //        testJredis.modelCacheService.addListByPrefixID("1",list);
    //        ArrayList<Integer>  cacheList= (ArrayList<Integer>) testJredis.modelCacheService.findListByPrefixID("1");
    //            testJredis.jRedisCache.putList("1",list);
    //            ArrayList<Integer>  cacheList= (ArrayList<Integer>) testJredis.jRedisCache.getList("1");
    //        for (int value:cacheList){
    //            System.out.println(value);
    //        }
    int[] tt = new int[3];
    tt[0] = 1;
    tt[1] = 2;
    tt[2] = 3;
    System.out.println(tt[-1]);

}

From source file:org.bfr.querytools.Main.java

public static void main(String args[]) throws IOException {
    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
    System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "DEBUG");
    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "ERROR");

    //      GoogleSpectrumQuery.query(40.69940, -74.04056);
    //      MsrSpectrumQuery.query(40.69940, -74.04056);
    SpectrumBridgeQuery.query(40.69940, -74.04056, true);

}

From source file:com.pasi.pdfbox.Main.java

public static void main(String[] args) throws Exception {
    System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider");
    String file = args != null && args.length > 0 ? args[0] : "/Users/bean/Desktop/Patient_BP_Report-v0.08.pdf";

    PatientBloodPressureReport report = createPatientBloodPressureReport();
    PDDocument document = new PDDocument();
    DocWriter writer = new PBPRptDocWriter(document, report);
    writer.write(file, "all", "readonly");

    /*//  w  ww . j av  a 2s . c o  m
    PDDocument doc = new PDDocument();
    PDPage page = new PDPage();
    doc.addPage(page);
    try {
    PDPageContentStream contents = new PDPageContentStream(doc, page, PDPageContentStream.AppendMode.APPEND, true);
    float pageHeight = page.getMediaBox().getHeight() - 20;
            
    PDText text = new PDText(20, pageHeight, "The Apache PDFBox library is an open source Java tool for working with PDF documents. This project allows creation of new PDF documents, manipulation of existing documents and the ability to extract content from documents. Apache PDFBox also includes several command line utilities. Apache PDFBox is published under the Apache License v2.0.");
            
    float height = writeText(contents, text);
            
    PDText title = new PDText(20, pageHeight - height - 20, "Bar Chart Example");
            
    writeText(contents, title);
            
    JFreeChart chart = createBarChart();
    BufferedImage image = chart.createBufferedImage(600, 400);
    PDImageXObject pdImage = LosslessFactory.createFromImage(doc, image);
    float scale = 1f;
    //contents.drawImage(pdImage, 20, 500, pdImage.getWidth() * scale, pdImage.getHeight() * scale);
            
    contents.close();
            
    doc.save(new File("/Users/bean/Desktop/Patient_BP_Report-v0.08.pdf"));
    doc.close();
    } catch (IOException e) {
    e.printStackTrace();
    }
    */

}

From source file:se.etimo.etimocoin.Application.java

public static void main(String[] args) throws Exception {
    System.setProperty("spring.jackson.serialization.INDENT_OUTPUT", "true");
    SpringApplication.run(Application.class, args);
}

From source file:caarray.client.test.java.JavaTest.java

/**
 * @param args//w w  w.  j  av a  2  s .com
 */
public static void main(String[] args) {
    TestMain test = new TestMain();
    try {
        System.setProperty(TestProperties.API_KEY, TestProperties.API_JAVA);
        test.runTests(new JavaApiFacade());
    } catch (Throwable t) {
        System.out.println("An unexpected error occurred during test execution.");
        t.printStackTrace();
        log.error("Exception encountered:", t);
    }
}

From source file:lunch.web.LunchWebServer.java

public static void main(String[] args) {
    System.setProperty("server.port", "9112");
    SpringApplication.run(LunchWebServer.class, args);
}

From source file:caarray.client.test.grid.GridTest.java

/**
 * @param args/* ww  w .ja v a 2s.co m*/
 */
public static void main(String[] args) {
    TestMain test = new TestMain();
    try {
        System.setProperty(TestProperties.API_KEY, TestProperties.API_GRID);
        test.runTests(new GridApiFacade());
    } catch (Throwable t) {
        System.out.println("An unexpected error occurred during test execution.");
        t.printStackTrace();
        log.error("Exception encountered:", t);
    }

}

From source file:sample.tomcat.SampleTomcatSslApplication.java

public static void main(String[] args) throws Exception {
    System.setProperty("jasypt.encryptor.password", "password");
    SpringApplication.run(SampleTomcatSslApplication.class, args);
}

From source file:com.mirth.connect.cli.launcher.CommandLineLauncher.java

public static void main(String[] args) {
    System.setProperty("log4j.configuration", "log4j-cli.properties");
    logger = Logger.getLogger(CommandLineLauncher.class);

    try {/*from   ww w  . j  a va2s .co m*/
        ManifestFile mirthCliJar = new ManifestFile("cli-lib/mirth-cli.jar");
        ManifestFile mirthClientCoreJar = new ManifestFile("cli-lib/mirth-client-core.jar");
        ManifestDirectory cliLibDir = new ManifestDirectory("cli-lib");
        cliLibDir.setExcludes(new String[] { "mirth-client-core.jar" });

        ManifestEntry[] manifest = new ManifestEntry[] { mirthCliJar, mirthClientCoreJar, cliLibDir };

        List<URL> classpathUrls = new ArrayList<URL>();
        addManifestToClasspath(manifest, classpathUrls);
        addSharedLibsToClasspath(classpathUrls);
        URLClassLoader classLoader = new URLClassLoader(classpathUrls.toArray(new URL[classpathUrls.size()]));
        Class<?> cliClass = classLoader.loadClass("com.mirth.connect.cli.CommandLineInterface");
        Constructor<?>[] constructors = cliClass.getDeclaredConstructors();

        for (int i = 0; i < constructors.length; i++) {
            Class<?> parameters[] = constructors[i].getParameterTypes();

            if (parameters.length == 1) {
                constructors[i].newInstance(new Object[] { args });
                i = constructors.length;
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}