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("java.runtime.version", "Java Runtime 1.6.0");

    System.out.println(System.getProperty("java.runtime.version"));
}

From source file:Main.java

public static void main(String[] args) {
    System.setProperty("app.major.version", "1");
    System.setProperty("app.minor.version", "19");

    Integer major = Integer.getInteger("app.major.version");
    Integer minor = Integer.getInteger("app.minor.version");
    System.out.println("App version = " + major + "." + minor);
}

From source file:Main.java

public static void main(String[] args) {

    System.setProperty("Java2s.com", "12345");
    String str = "Java2s.com";
    System.out.println(Long.getLong(str));

}

From source file:MainClass.java

public static void main(String[] args) {
    System.setProperty("password", "myPassword");
    System.out.println(System.getProperty("password"));

}

From source file:Main.java

public static void main(String[] args) {

    System.setProperty("Java2s.com", "12345");
    String str = "Java2s.com";
    System.out.println(Long.getLong(str, 123L));

    System.out.println(Long.getLong("java", 123L));
}

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);

    sm.checkLink("JDBC");

    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);

    sm.checkAccept("www.java2s.com", 8080);

    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);

    // perform the check
    sm.checkDelete("test.txt");

    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);

    // perform the check
    sm.checkConnect("www.java2s.com", 8080);

    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);

    // perform the check
    sm.checkExec("notepad.exe");

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