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

public static void main(String[] args) {

    System.setProperty("java2s1", "true");
    System.setProperty("java2s2", "abcd");

    boolean bool1 = Boolean.getBoolean("java2s1");
    boolean bool2 = Boolean.getBoolean("java2s2");

    System.out.println("boolean value of system property java2s1 is " + bool1);
    System.out.println("boolean value of system property java2s2 is " + bool2);

}

From source file:Main.java

public static void main(String[] args) {

    System.setProperty("java.security.policy", "file:/C:/java.policy");

    SecurityManager sm = new SecurityManager();

    System.setSecurityManager(sm);

    // perform the check
    sm.checkAwtEventQueueAccess();/* w ww .j a v a 2s .com*/

    System.out.println("Allowed!");
}

From source file:Main.java

public static void main(String[] args) {

    System.setProperty("java.security.policy", "file:/C:/java.policy");

    SecurityManager sm = new SecurityManager();

    System.setSecurityManager(sm);

    Object con = sm.getSecurityContext();

    System.out.println(con);/*from   w ww  .  jav  a  2  s.  c o  m*/

}

From source file:Main.java

public static void main(String[] args) {

    System.setProperty("java.security.policy", "file:/C:/java.policy");

    SecurityManager sm = new SecurityManager();

    System.setSecurityManager(sm);

    ThreadGroup con = sm.getThreadGroup();

    System.out.println(con);//from w  ww .  jav  a2 s.c o m

}

From source file:Main.java

public static void main(String[] args) {
    System.setProperty("myColor", "0XFFFFFF");
    Color myColor = Color.getColor("myColorNew", 0XFF00FF);

    System.out.println(myColor);/*from   ww w.j  ava 2 s  . c o  m*/

}

From source file:Main.java

public static void main(String[] args) {
    System.setProperty("myColor", "0XFFFFFF");
    Color myColor = Color.getColor("myColorNew", Color.RED);

    System.out.println(myColor);/*  w ww.  ja  v a 2  s  . c  o m*/

}

From source file:Main.java

public static void main(String[] args) {
    System.setProperty("myColor", "0XFFFFFF");
    Color myColor = Color.getColor("myColor");

    System.out.println(myColor);/*from   w  ww .  j  a v  a2 s  . co m*/

}

From source file:Main.java

public static void main(String[] args) {
    String myKey = "MyKey";
    System.setProperty(myKey, "102");
    System.out.println(Integer.getInteger(myKey));
}

From source file:Main.java

public static void main(String[] args) {
    String myKey = "MyKey";
    System.setProperty(myKey, "102");
    System.out.println(Integer.getInteger(myKey));
    System.out.println(Integer.getInteger("NoExist", 999));
}

From source file:Main.java

public static void main(String[] args) {
    String myKey = "MyKey";
    System.setProperty(myKey, "102");
    System.out.println(Integer.getInteger(myKey));
    System.out.println(Integer.getInteger("NoExist", new Integer(999)));
}