Example usage for java.lang System getProperty

List of usage examples for java.lang System getProperty

Introduction

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

Prototype

public static String getProperty(String key) 

Source Link

Document

Gets the system property indicated by the specified key.

Usage

From source file:Main.java

public static String getNewLine() {
    return System.getProperty("line.separator");
}

From source file:Main.java

public static String getCharset() {
    return System.getProperty("file.encoding");
}

From source file:Main.java

public static String getSystemTmpDir() {
    return System.getProperty("java.io.tmpdir");
}

From source file:Main.java

public static String getProjectPath() {
    return System.getProperty("user.dir");
}

From source file:Main.java

public static final int getOSType() {
    if (System.getProperty("os.name").trim().toLowerCase().contains("windows"))
        return 0;
    if (System.getProperty("os.name").trim().toLowerCase().contains("mac")) {
        return 1;
    }//w w w .  j  a  va2s.c om

    return -1;
}

From source file:Main.java

public static boolean isAndroid() {
    return isAndroid(System.getProperty("java.vm.name"));
}

From source file:Main.java

public static String getJavaHomePath() {
    String javaHome = System.getProperty("java.home");

    return javaHome + "/bin";
}

From source file:Main.java

public static String[] getJavaClassPaths() {
    String[] classPaths = System.getProperty("java.class.path").split(System.getProperty("path.separator"));
    return classPaths;
}

From source file:Main.java

static double getJavaVersion() {
    String version = System.getProperty("java.version");

    // on android this property equals to 0
    if (version.equals("0"))
        return 0;

    int pos = 0, count = 0;
    for (; pos < version.length() && count < 2; pos++) {
        if (version.charAt(pos) == '.')
            count++;//w  ww.j ava 2  s  .  co m
    }
    return Double.parseDouble(version.substring(0, pos - 1));
}

From source file:Main.java

public static String breakLine(String text) {
    return text.replace("\\n", System.getProperty("line.separator"));
}