Example usage for java.lang Runtime getRuntime

List of usage examples for java.lang Runtime getRuntime

Introduction

In this page you can find the example usage for java.lang Runtime getRuntime.

Prototype

public static Runtime getRuntime() 

Source Link

Document

Returns the runtime object associated with the current Java application.

Usage

From source file:Main.java

public static void startView(String viewTag) {
    try {//from   w  w  w.  ja  v a  2 s  .com
        Process p1 = Runtime.getRuntime().exec("cleartool startview " + viewTag);
        p1.waitFor();
        p1.destroy();
    } catch (Exception e) {
        throw new RuntimeException("cleartool startview error!", e);
    }
}

From source file:Main.java

public static void openBar() {
    Process proc;// ww w  .java2  s . c  om
    try {
        proc = Runtime.getRuntime().exec("am startservice --user 0 -n com.android.systemui/.SystemUIService");
        proc.waitFor();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static boolean hasMoreHeap() {
    return Runtime.getRuntime().maxMemory() > 20971520;
}

From source file:Main.java

public static void limparMemoria() {
    System.gc();// ww  w.j av  a  2 s  .c o  m
    Runtime.getRuntime().gc();

    Log.i("GC", "LIMPANDO MEMORIA ANDROID");
}

From source file:Main.java

static public void clearLogCat() {
    try {//w  w  w . j  a v a2s  .com
        Runtime.getRuntime().exec("logcat -c");
    } catch (Exception e) {
    }
}

From source file:Main.java

public static long getMaxMemory() {
    long memory = Runtime.getRuntime().maxMemory() / (1024 * 1024 * 1024);
    if (memory < 1) {
        memory = Runtime.getRuntime().maxMemory() / (1024 * 1024);
    }//w w w .j  a v  a  2  s  .co  m
    return memory;
}

From source file:Main.java

public static boolean isLargeHeap() {
    return Runtime.getRuntime().maxMemory() > HEAP_SIZE_LARGE;
}

From source file:Main.java

public static int getNumberOfThread() {
    final float scaleFactor = 1.7f;
    final int maxThread = Math.round(Runtime.getRuntime().availableProcessors() * scaleFactor);
    return maxThread;
}

From source file:Main.java

public static void setConfigSpec(String viewTag, String configSpecFilePath) {
    try {/*from  w  w  w .  j a  v  a  2 s. c  o  m*/
        Process pr = Runtime.getRuntime().exec("cleartool setcs -tag " + viewTag + " " + configSpecFilePath);
        pr.waitFor();
        pr.destroy();
    } catch (Exception e) {
        throw new RuntimeException("cleartool setcs error!", e);
    }

}

From source file:Main.java

public static void mkView(String viewTag) {
    try {/* w w w.  j  a  va 2s  .  c  o  m*/
        Process pr = Runtime.getRuntime().exec("cleartool mkview -tag " + viewTag + " \\\\"
                + InetAddress.getLocalHost().getHostName() + "\\viewstore\\" + viewTag + ".vws");
        pr.waitFor();
        pr.destroy();
    } catch (Exception e) {
        throw new RuntimeException("cleartool mkview error!", e);
    }
}