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 main(String[] argv) {

    long heapSize = Runtime.getRuntime().totalMemory();
    System.out.println(heapSize);
}

From source file:ExecDemo.java

public static void main(String args[]) {
    Runtime r = Runtime.getRuntime();
    Process p = null;/*from w w w . ja va  2  s . c om*/

    try {
        p = r.exec("notepad");
    } catch (Exception e) {
        System.out.println("Error executing notepad.");
    }
}

From source file:Main.java

public static void main(String[] argv) {

    long heapMaxSize = Runtime.getRuntime().maxMemory();
    System.out.println(heapMaxSize);
}

From source file:Main.java

public static void main(String[] argv) {

    long heapFreeSize = Runtime.getRuntime().freeMemory();
    System.out.println(heapFreeSize);
}

From source file:Main.java

public static void main(String[] args) {

    Runtime runTime = Runtime.getRuntime();
    runTime.runFinalizersOnExit(true);

}

From source file:Main.java

public static void main(String[] args) {
    Runtime runtime = Runtime.getRuntime();

    int nrOfProcessors = runtime.availableProcessors();

    System.out.println("Number of processors available to the Java Virtual Machine: " + nrOfProcessors);
}

From source file:Main.java

public static void main(String[] args) {

    Runtime runTime = Runtime.getRuntime();
    runTime.load("C:/Windows/System32/crypt32.dll");

}

From source file:Main.java

public static void main(String[] args) {

    Runtime runTime = Runtime.getRuntime();
    runTime.loadLibrary("C:/Windows/System32/crypt32.dll");

}

From source file:Main.java

public static void main(String[] args) {

    Runtime runTime = Runtime.getRuntime();
    runTime.gc();/*from ww w  .  ja  va 2 s .co m*/
    System.out.println("Completed.");
}

From source file:Main.java

public static void main(String[] args) {

    Runtime runTime = Runtime.getRuntime();
    runTime.traceMethodCalls(true);

}